I currently query a table for items with a certain category
. I have extended this query to also looks within the item description
column too. My question is, how do i order results so that the category
matches are first and the description is last?
`SELECT * FROM myTable WHERE `category` LIKE '%keyword%' || `description` LIKE '%keyword%'
In my above query simply adding a ORDER BY category
will not suffice. The only way I can think of doing this is two separate queries with two separate result variables.
I'm using php
and mysqli