Question about Searching with several keywords in a table
Hi,
I'm working on a search engine used in a program we're creating.
The enduser must be able to search into the database by giving keywords
to search for.
For example a table is filled with the following:
car, bike, motor, plane.
When a user enter the keywords: 'car bike motor'
the searching goes well with the following:
SELECT * FROM company
WHERE UPPER(products) LIKE '%CAR%BIKE%MOTOR%'
I use parameters btw, I convert the entered words into a string where
spaces (and commas) are replaced by %. Using this sequence it works.
But, now my question:
Suppose the user enters: 'Motor Car', then nothing is found since
the sequance is different.
As possible solutions I have splitting the words into several parameters
and then search using: SELECT * FROM company
WHERE UPPER(products) LIKE '%word1%'
AND UPPER(products) LIKE '%word2%'
AND UPPER(products) LIKE '%word3%'
etc. Get the point ? Now I was wondering if there isn't another possible
solution, I have a list of SQL commandos found in Delphi but no other
explanation can be found in Delphi online Help or the manuals.
If you have the answer/possible solution then please mail it to me since
I don't regurly check the newsgroups.
Thanks in Advance,
Pim van Mun