Hi, wondering if anyone can kindly help please
After some help with a business search I have on a business directory. In the search you can either search for a company name ie:
Gregs Bar & Restaurant
Or a Business type ie:
And in my database I have a businesses table:
And a categories table:
So what I want to do is run a query which will query these two tables which I do like so.
However, where I'm stuck is where a user searches for a category ie: Fast Food. For example when Fast Food is searched for I also want results returned for:
WHERE businesses.name = 'Fast Food'
WHERE categories.name = 'Fast Food'
- Take Away – as it falls into the same category as fast food
- Quick Bites – as it falls into the same category as fast food
(As they are all kind of the same thing)
So for example I want my search to :
1) Query the two tables for what the search term ie: Fast Food
When it finds Fast Food in the categories table look in the also_falls_into_category column of this table for Fast Food (piped separated)
2) Then explode on the pipes and continue with the query and output all the businesses in the businesses table where any of the pipe separated values are matches in the falls_into_category column. So in effect when you search for fast food, you also get results returned for take away and quick bites.
Can anyone help please?