[thelist] MySQL search everywhere?

r937 rudy at r937.com
Tue Oct 6 13:26:05 CDT 2009


> SELECT * FROM * WHERE ??? = "foo"
> 
> I don't know what to put at the "???".  
> I want to search all tables, all fields, for the string.


sorry stephen, it's not good news

SELECT * FROM table1
WHERE column1 LIKE '%foo%'
   OR column2 LIKE '%foo%
   OR column3 LIKE '%foo%
   OR column4 LIKE '%foo%
   OR column5 ...

SELECT * FROM table2
WHERE column6 LIKE '%foo%'
   OR column7 LIKE '%foo%
   OR column8 LIKE '%foo%
   OR column9 LIKE '%foo%
   OR column10 ...


rudy
http://r937.com/




More information about the thelist mailing list