Dec 17, 2002 #1 ashz Programmer Dec 9, 2002 43 ES How can I run a SQL statement that will search for a text (e.g. "omni" in the entire field and in all the records?
How can I run a SQL statement that will search for a text (e.g. "omni" in the entire field and in all the records?
Dec 17, 2002 #2 Trana Technical User Nov 2, 2002 76 AU Im not sure I understood you correctly, but this will work for a search in a one column in one table. SELECT * FROM table_name WHERE column_name like '%omni%' If your using a string from a html form text field the $_GET variabel you have for that value can just be inserted into the search string, ie: ...like '%$variable%' Upvote 0 Downvote
Im not sure I understood you correctly, but this will work for a search in a one column in one table. SELECT * FROM table_name WHERE column_name like '%omni%' If your using a string from a html form text field the $_GET variabel you have for that value can just be inserted into the search string, ie: ...like '%$variable%'
Dec 17, 2002 Thread starter #3 ashz Programmer Dec 9, 2002 43 ES Thanks. But How to search in all the columns in one table. Upvote 0 Downvote
Dec 17, 2002 #4 danielhozac Programmer Aug 21, 2001 2,058 SE Code: SELECT * FROM <table> WHERE <column_1> LIKE '%<string>%' OR <column_2> LIKE '%<string>%' And so on... //Daniel Upvote 0 Downvote
Code: SELECT * FROM <table> WHERE <column_1> LIKE '%<string>%' OR <column_2> LIKE '%<string>%' And so on... //Daniel
Dec 17, 2002 Thread starter #5 ashz Programmer Dec 9, 2002 43 ES Is there a shorter way since I have a lot of columns Upvote 0 Downvote