I'm having a logic issue with my SQL statement. I'm building a SQL string based on form data. Here's an example of the final WHERE clause:
TITLE = 'Advertising Manager' OR TITLE = 'Advertising Assoc' OR TITLE = 'Advertising VP' AND STATE LIKE '%ca%' AND FIRSTNAME LIKE '%Chuck%'
My issue is, the 'OR' statements return results while ignoring the AND results. What is the appropriate way to return the OR results, then search within them to narrow down to compensate for the AND criteria? I know this is most likely more of a SQL forumn question, however this forumn was home for me for many years! THANKS!
DeZiner
Never be afraid to try something new.
Remember that amateurs built the Ark.
Professionals built the Titanic
TITLE = 'Advertising Manager' OR TITLE = 'Advertising Assoc' OR TITLE = 'Advertising VP' AND STATE LIKE '%ca%' AND FIRSTNAME LIKE '%Chuck%'
My issue is, the 'OR' statements return results while ignoring the AND results. What is the appropriate way to return the OR results, then search within them to narrow down to compensate for the AND criteria? I know this is most likely more of a SQL forumn question, however this forumn was home for me for many years! THANKS!
DeZiner
Never be afraid to try something new.
Remember that amateurs built the Ark.
Professionals built the Titanic