Page 1 of 1

mysql searching

Posted: Mon Jun 20, 2005 9:21 pm
by spartan7
I need to do a single keyword search that searches multiple columns in the same table (and across another table) for example :

Table> ID First Name, Last Name, Cel, Fax etc

I need to search all of those fields at once.

How do I use one search box/query to search for multiple records searching all those columns/fields at once?

Thanks

Posted: Tue Jun 21, 2005 12:57 am
by timvw
Well, you can add restrictions on the returned rows with the WHERE clause.
And you can use AND and OR to add multiple restrictions...

Code: Select all

SELECT * FROM table WHERE col1='bar' OR col2='bar'
SELECT * FROM table WHERE col1='foo' AND col2='foo'