I asked for a single query in my previous question but now I want to ask about multiple queries.
I'm making a search engine that searches through some specific tables.
When the input is "testone testtwo testthree" I will need to do a lot of queries.
- a search with the complete string
- a search with the 3 words in 3 strings ( if they can be seperately found in one item)
- a search with 2 words in a combined string
- a search with 2 words in 2 strings
- a search with all words apart
As you know this decides what is a more important result.
I am building the queries seperately for all the 5 searches above as well as seperate for each table because a result from one table can be more important than from the other.
I made the queries like this:
SELECT *
FROM company_address
WHERE address_street LIKE '%test%'
OR address_zipcode LIKE '%test%'
OR address_telephone LIKE '%test%'"
OR address_fax LIKE '%test%'
OR address_website LIKE '%test%'
I know this is not the best way to do it, and because you guys are much better than me with this i would love some advice!