Wednesday, 21 August 2013

SQL query with INNER JOIN and WHERE

SQL query with INNER JOIN and WHERE

I am getting the following message when trying to get a specific value in
my query
"The specified field could refer to more than one table"
It is pretty clear that I am trying to search something present in more
than one table, but how to do this right?
now I have the following code:
SELECT Table1.CustomerId, Table1.Address,
Table2.CustomerId, Table2.Telephone,
Table3.CustomerId, Table3.Notes
FROM (Table1 INNER JOIN Table2 ON Table1.CustomerId=TAble2.CustomerId)
INNER JOIN Table3 ON Table2.CustomerId=Table3.CustomerId
WHERE CustomerId = 0015
the last sentence is the problem... any ideas?

No comments:

Post a Comment