Bopinko Bopinko - 4 years ago 66
SQL Question

AmbiguousColumnName

I just have an example for querry in MS SQL SERVER 2016:
Write SQL code, which will show Values InvoiceNumber from table INVOICE, which includes a value ............. I need join 3 tables, this is my code

SELECT InvoiceNumber
FROM INVOICE AS I INNER JOIN LINE_ITEM AS LI
ON(I.InvoiceNumber = LI.InvoiceNumber)
INNER JOIN PRODUCT AS P
ON(LI.ProductNumber = P.ProductNumber)
WHERE Description = 'Heather Sweeney Seminar Live in Dakkas on 25-OCT-09 - Video'


and always say :


Ambiguous column name InvoiceNumber in line Where is SELECT QUERRY.

Answer Source

If 2 tables have the same columns then you have to tell in the query which column you want to use. Do that by adding the table name in front of it.

SELECT I.InvoiceNumber FROM INVOICE AS I ...
Recommended from our users: Dynamic Network Monitoring from WhatsUp Gold from IPSwitch. Free Download