JFRobishow
Technical User
Hi,
I have been trying to get this SQL query to work for a while now and it always return 0 record. I'm trying to search multiple fields for a keyword stored in an array like this:
sql2 = "SELECT * FROM table_name WHERE (type=1 AND desc LIKE '%"+arrKeyWords(0)+"%') OR (type=1 AND mc1 LIKE '%"+arrKeyWords(0)+"%')"
type=1 is a flag that is either 0 or 1 but I want results that are flagged as 1. Now this is working fine if the keyword is found in desc but not mc1.
What is the correct syntax to search in two fields?
The string then go in a "for loop" that add the other keywords to the query using UNION. If I can get the first one to work the rest should be a breeze.
I have been trying to get this SQL query to work for a while now and it always return 0 record. I'm trying to search multiple fields for a keyword stored in an array like this:
sql2 = "SELECT * FROM table_name WHERE (type=1 AND desc LIKE '%"+arrKeyWords(0)+"%') OR (type=1 AND mc1 LIKE '%"+arrKeyWords(0)+"%')"
type=1 is a flag that is either 0 or 1 but I want results that are flagged as 1. Now this is working fine if the keyword is found in desc but not mc1.
What is the correct syntax to search in two fields?
The string then go in a "for loop" that add the other keywords to the query using UNION. If I can get the first one to work the rest should be a breeze.