I’m developing a search functionality with pagination in my site to search for the product name and the brand name. I’m using this query to get the user’s search request:
SELECT *
from products
WHERE name = 'optimum nutrition'
OR brand = 'optimum nutrition'
OR name LIKE '%optimum%'
OR brand LIKE '%optimum%'
OR name LIKE '%nutrition%'
OR brand LIKE '%nutrition%'
I would like to display first the products that has the full ‘optimum nutrition’ in either the brand name and in the product name. How will I accomplish this?
Any suggestion would be greatly appreciated.
Try: