SQL search all columns [modified]
-
I am trying to do a search on all the data in a specific table. How do I search across all columns? And how do I search period? The LIKE command isn't working how I'd like it to, or I am not using it right. EXAMPLE: Player Name: John Doe Johnny Hopkins Night Hawk I would like to be able to search 'john' and get the first two records return, or 'doe' for the first, or 't h' and get the third ect. The LIKE command seems to be too picky although I may be wrong... Thanks for your time.
The best way to accelerate a Macintosh is at 9.8m/sec² - Marcus Dolengo
modified on Saturday, March 7, 2009 10:51 AM
-
I am trying to do a search on all the data in a specific table. How do I search across all columns? And how do I search period? The LIKE command isn't working how I'd like it to, or I am not using it right. EXAMPLE: Player Name: John Doe Johnny Hopkins Night Hawk I would like to be able to search 'john' and get the first two records return, or 'doe' for the first, or 't h' and get the third ect. The LIKE command seems to be too picky although I may be wrong... Thanks for your time.
The best way to accelerate a Macintosh is at 9.8m/sec² - Marcus Dolengo
modified on Saturday, March 7, 2009 10:51 AM
-
I am trying to do a search on all the data in a specific table. How do I search across all columns? And how do I search period? The LIKE command isn't working how I'd like it to, or I am not using it right. EXAMPLE: Player Name: John Doe Johnny Hopkins Night Hawk I would like to be able to search 'john' and get the first two records return, or 'doe' for the first, or 't h' and get the third ect. The LIKE command seems to be too picky although I may be wrong... Thanks for your time.
The best way to accelerate a Macintosh is at 9.8m/sec² - Marcus Dolengo
modified on Saturday, March 7, 2009 10:51 AM
What does your SQL statement look like? It should look something like this:
SELECT PlayerName FROM Table WHERE UPPER(FirstName) LIKE '%JOHN%' OR UPPER(LastName) LIKE '%JOHN%'
But if you really have to search ALL columns you will have to add a LIKE for each column name in the WHERE portion of you statement. Hope this helps.