Here is my query:
SELECT ID, Name, Description
FROM MyTable
WHERE NAME LIKE :search OR Description LIKE '%search%'
OR Status LIKE '%search%'
OR ... Many Other Columns LIKE '%search%
When I get the data I display it to the user that they searched for. Now I only display ID, Name & Description
. I also want to display which column matched the searching string. If it matched Status
I want to display the status of the row, if it matched any other column I want to display the value of that column that it matched.
Does not matter if it matches multiple columns. I only need the first one.
Is this possible without selecting all columns & then running PHP search on each to find out which one matched? Can it be done simply in MySQL?
I want to make it as fast as possible since my search is becoming pretty slow the more columns & more tables I add to the search and do not want this feature to add a lot of overhead.