johnsmith180
Programmer
Hi
IN SHORT:
How do you write a search query that searches for multiple words, BUT only returns a row if ALL the words are found within a row
IN DETAILS:
I have been trying to solve this problem for a long time, but with no luck. It seems very simple, but I dont have a clue how to do it.
Basically, I want to write a search query that will search in my product table. I have following table structure:
Products (productID, name, description)
OtherInfo (ID, Manufacturer, MachineName, productID)
Now a user can enter 'monitors sensors'.
I want to search in the above tables, and only return a record if 'monitors' AND 'sensors' are found for a product.
So I may write somethign like:
Select * from Products p
Inner Join OtherInfo o on p.ProductID=o.ProductID
where p.productid like ' < Search for Monitors AND Sensors >'
OR o.manufacturer like '< Search for Monitors AND Sensors >'
......
(I would like to use the LIKE operator instead of IN operator).
So Any idea how I can achieve this
I would be grateful if you can put me in the right direction.
Kind regards
IN SHORT:
How do you write a search query that searches for multiple words, BUT only returns a row if ALL the words are found within a row
IN DETAILS:
I have been trying to solve this problem for a long time, but with no luck. It seems very simple, but I dont have a clue how to do it.
Basically, I want to write a search query that will search in my product table. I have following table structure:
Products (productID, name, description)
OtherInfo (ID, Manufacturer, MachineName, productID)
Now a user can enter 'monitors sensors'.
I want to search in the above tables, and only return a record if 'monitors' AND 'sensors' are found for a product.
So I may write somethign like:
Select * from Products p
Inner Join OtherInfo o on p.ProductID=o.ProductID
where p.productid like ' < Search for Monitors AND Sensors >'
OR o.manufacturer like '< Search for Monitors AND Sensors >'
......
(I would like to use the LIKE operator instead of IN operator).
So Any idea how I can achieve this
I would be grateful if you can put me in the right direction.
Kind regards