I have been trying to JOIN 3 tables together without success.
The line beginning with AND is the offending line
Can someone please let me know what it should be
Many Thanks
Ian
sSQLStatement = _
"SELECT Contacts.PostalName, Contacts.CompanyName, Addresses.Position, "+ _
"Addresses.Department, Addresses.Address1, Addresses.Address2, "+ _
"Addresses.Address3, Addresses.PostCode, Addresses.Town, Addresses.County, "+ _
"Addresses.Country, Contacts.ContactID, Transations.DeliveryAddress " + _
"FROM Contacts JOIN Addresses ON Contacts.AddressID=Addresses.AddressID " + _
"AND Contacts JOIN Transactions ON Contacts.ContactID=Transactions.ContactID " + _
"WHERE Transactions.PaymentSecondRef LIKE '"+TBSNo+"' " + _
"AND Addresses.DefaultAddress = 1"
I am using SQL Tools with some success BUT in their help file there is no help for the JOIN option
The following 2 paragraphs come from their help file!
"You may also notice that certain relatively common syntax elements are not included here, such as the SELECT statement's GROUP BY, HAVING, UNION and JOIN clauses. Again, these keywords are not part of the minimum ODBC syntax, and some ODBC drivers may not support them, so they are not covered here.
For complete information about the syntax that your ODBC driver accepts, you will need to acquire additional, driver-specific reference materials."
The line beginning with AND is the offending line
Can someone please let me know what it should be
Many Thanks
Ian
sSQLStatement = _
"SELECT Contacts.PostalName, Contacts.CompanyName, Addresses.Position, "+ _
"Addresses.Department, Addresses.Address1, Addresses.Address2, "+ _
"Addresses.Address3, Addresses.PostCode, Addresses.Town, Addresses.County, "+ _
"Addresses.Country, Contacts.ContactID, Transations.DeliveryAddress " + _
"FROM Contacts JOIN Addresses ON Contacts.AddressID=Addresses.AddressID " + _
"AND Contacts JOIN Transactions ON Contacts.ContactID=Transactions.ContactID " + _
"WHERE Transactions.PaymentSecondRef LIKE '"+TBSNo+"' " + _
"AND Addresses.DefaultAddress = 1"
I am using SQL Tools with some success BUT in their help file there is no help for the JOIN option
The following 2 paragraphs come from their help file!
"You may also notice that certain relatively common syntax elements are not included here, such as the SELECT statement's GROUP BY, HAVING, UNION and JOIN clauses. Again, these keywords are not part of the minimum ODBC syntax, and some ODBC drivers may not support them, so they are not covered here.
For complete information about the syntax that your ODBC driver accepts, you will need to acquire additional, driver-specific reference materials."
Comment