SELECT
*
FROM
[SQL].[dbo].[Debtors] d
JOIN
[SQL].[dbo].[DebtorIndex] di
JOIN
[SQL].[dbo].[DebtorAddresses] da ON d.IDNumber = di.IDNumber
AND d.AutoNumber = da.DebtorID
AND da.DebtorID = '199'
I am getting this error
Msg 102, Level 15, State 1, Line 3
Incorrect syntax near 'da'.
First however there is nothing there. Is there supposed to be something else there?
Second for [SQL].[dbo].[Debtors] d, I know for a fact and have triple checked that d.IDNumber & d.AutoNumber exist but I get the following error for both
"The multi-part identifier "d.IDNumber" could not be bound."
and get the same for d.AutoNumber.
Please help. Thanks in advance
AutoNumberandIDNumber? It sounds like they're bothIDENTITYor primary-key attributes, in which case one is redundant. Also avoid using the term "Autonumber" as it doesn't apply to SQL Server.