Multiple Queries in mySQL in a single statement?
Posted: Sun Mar 14, 2004 9:35 am
I'm trying to do an advanced search function with my database.
So far the only thing that works is a two field Search.
This is the sql statement.
SELECT *
FROM contacts
WHERE region LIKE '%region%' AND sport LIKE '%sport%'
ORDER BY sport ASC
What I really want to happen is (this is just theory so bear with me)
SELECT *
FROM contacts
WHERE region LIKE '%region%' AND sport LIKE '%sport%' AND level LIKE '%level%' AND genre LIKE '%genre%' AND name LIKE '%name%'
ORDER BY sport ASC
Is this possible or am I barking up the wrong tree... I'm just not sure how to search more than two fields in a database or the correct syntax if possible.
Any help would be greatly appreciated!
So far the only thing that works is a two field Search.
This is the sql statement.
SELECT *
FROM contacts
WHERE region LIKE '%region%' AND sport LIKE '%sport%'
ORDER BY sport ASC
What I really want to happen is (this is just theory so bear with me)
SELECT *
FROM contacts
WHERE region LIKE '%region%' AND sport LIKE '%sport%' AND level LIKE '%level%' AND genre LIKE '%genre%' AND name LIKE '%name%'
ORDER BY sport ASC
Is this possible or am I barking up the wrong tree... I'm just not sure how to search more than two fields in a database or the correct syntax if possible.
Any help would be greatly appreciated!