[thelist] SQL help

Roee Rubin webdesign1 at irubin.com
Thu Sep 27 12:52:52 CDT 2001


Hello,

I am having some problems generating a SQL statement (SQL has never been my
strong point).

I have a table with the following fields:

===============
=     Shop    =
===============
=    ShopID   =
= CompanyName =
=     City    =
=    State    =
= Brief_Desc  =
=   Active    =
===============

I would like to perform a keyword search so that when a user searches for
the phrase 'what ever' the CompanyName, City, State and Brief_Desc fields
would be searched for a match. The results will only be displayed if the
Active value IS NOT 0.

Some general information => MySQL running on Linux .

Below is a snippet of mysql statement. Something is just not working right
...

Any help will be appreciated.

<snip>
SELECT * FROM Shop WHERE Active <> "0" AND CompanyName LIKE "%what%" OR
Brief_Desc LIKE "%what%" OR City LIKE "%what%" OR  State LIKE "%what%"
CompanyName LIKE "%ever%" OR Brief_Desc LIKE "%ever%" OR City LIKE "%ever%"
OR State LIKE "%ever%" ORDER BY State ASC
</snip>



Roee Rubin
Irubin Consulting
roee at irubin.com
http://www.irubin.com/






More information about the thelist mailing list