I am setting up a SQL query that will be used to filter search results with a WHERE clause. In my MySQL DB, I have set up a "cat" column. Is there a way to enter more than one term in the cat field so I can give each row more than one category (such as 'child,solid')? I tried using an "," and ";" delimiter, but neither worked. It seems to only work if I have only one category in the cat field.
Thanks in advance for any help!
Gary
More than one term in category field???
Moderator: General Moderators
- jaoudestudios
- DevNet Resident
- Posts: 1483
- Joined: Wed Jun 18, 2008 8:32 am
- Location: Surrey
Re: More than one term in category field???
If you are using a MyIsam database engine, then you could do a Full text search.
Or explode the search field on white space and make your WHERE clause with ANDs or ORs.
ie. search term = walked downstairs
...WHERE column1 LIKE '%walked%' AND column1 LIKE '%downstairs%'
Or explode the search field on white space and make your WHERE clause with ANDs or ORs.
ie. search term = walked downstairs
...WHERE column1 LIKE '%walked%' AND column1 LIKE '%downstairs%'