seanybravo
IS-IT--Management
I am using this SQL statement on my ASP VB pages linking to an access database Jet 4.0. The query works fine until I put a OR statement on the where clause. I am sure its a bracketing problem but cant for the life of me sort it out. I have tried recreating the query in access and looking at the SQL generated by that but no joy. Any help would be appreciated. Thanks.
SELECT tblData.*, tblTitle.*, tblCustomCategory.* FROM (((((tblData LEFT JOIN (SELECT * FROM tblTitle IN 'E:\Websites\ebusinessdirectories\Database\Admin.mdb') AS tblTitle ON tblData.fldContactTitle = tblTitle.fldTitleID) LEFT JOIN tblCustomCategory ON tblData.fldCategory1 = tblCustomCategory.fldID) LEFT JOIN tblCustomCategory AS tblCustomCategory1 ON tblData.fldCategory2 = tblCustomCategory1.fldID) LEFT JOIN tblCustomCategory AS tblCustomCategory2 ON tblData.fldCategory3 = tblCustomCategory2.fldID) LEFT JOIN tblCustomCategory AS tblCustomCategory3 ON tblData.fldCategory4 = tblCustomCategory3.fldID) WHERE ((((tblCustomCategory.fldDefinition)) = 'A_Sean[0]')) OR ((((tblCustomCategory1.fldDefinition)) = 'A_Sean[0])) ORDER BY fldCompanyName
SELECT tblData.*, tblTitle.*, tblCustomCategory.* FROM (((((tblData LEFT JOIN (SELECT * FROM tblTitle IN 'E:\Websites\ebusinessdirectories\Database\Admin.mdb') AS tblTitle ON tblData.fldContactTitle = tblTitle.fldTitleID) LEFT JOIN tblCustomCategory ON tblData.fldCategory1 = tblCustomCategory.fldID) LEFT JOIN tblCustomCategory AS tblCustomCategory1 ON tblData.fldCategory2 = tblCustomCategory1.fldID) LEFT JOIN tblCustomCategory AS tblCustomCategory2 ON tblData.fldCategory3 = tblCustomCategory2.fldID) LEFT JOIN tblCustomCategory AS tblCustomCategory3 ON tblData.fldCategory4 = tblCustomCategory3.fldID) WHERE ((((tblCustomCategory.fldDefinition)) = 'A_Sean[0]')) OR ((((tblCustomCategory1.fldDefinition)) = 'A_Sean[0])) ORDER BY fldCompanyName