SQL Syntax error (finding common records in two tables) using VB6
Posted on 2007-10-10
I have two tables, and want to use VB6 to list those records where the contents of the COMPANY_NAME field is common to both tables. I've tried the following, but Microsoft says error.
SQLStr = "SELECT FROM DB_ALL_2.COMPANY_NAME " & _
"FROM DB_ALL_2 LEFT JOIN DB_ALL_1 ON DB_ALL_2.COMPANY_NAME = DB_ALL_1.COMPANY_NAME " & _
"WHERE (DB_ALL_1.COMPANY_NAME = DB_ALL_2.COMPANY_NAME)"
Recordset1.Open SQLStr, DbsConnection, adOpenStatic
Microsoft's error is:
'The SELECT statement includes a reserved word or an argument name that is misspelled or missing, or the punctuation is incorrect'