Reputation: 11
I am getting the following error:
Msg 209, Level 16, State 1, Line 3 Ambiguous column name 'NUM_0'.
SELECT BPR_0, BPAPAY_0, BPYNAM_0, BPYADDLIG_0, NUM_0 -- and so on
FROM PROD.SINVOICE, PROD.SINVOICED
WHERE SINVOICE.NUM_0 = SINVOICED.NUM_0
Upvotes: 1
Views: 90
Reputation: 50163
Qualify column name with table alise
explicitly :
select sin.col, . . ., sind.col, . . ., c.col, . . .
from prod.sininvoice sin inner join
prod.sininvoiced sind
on sind.num_0 = sin_num_0 inner join
prod.customer c
on . . .;
Upvotes: 1
Reputation: 32003
use Alias
properly
Example
SELECT o.OrderID, o.OrderDate, c.CustomerName
FROM Customers AS c, Orders AS o
WHERE c.CustomerName="Around the Horn" AND c.CustomerID=o.CustomerID;
For Your case
select t1.col1,t1.col2 ....t1.coln from yourtable t1
inner join yourtable t2 on t1.num0=t2.num0
Upvotes: 0
Reputation: 11
Since Column "NUM_0" exists in both SINVOICE and SINVOICED tables,you need to specify the column with using alias.
For example SINVOICE.NUM_O or SINVOICED.NUM_O in you select statement depending upon from which table you want this column value.
Upvotes: 0