Page 1 of 1

Mysql problem

Posted: Tue Mar 30, 2004 4:07 pm
by sulen
I am trying to run a join based on a where condition but something seems to be wrong with the way I am writing the query. The query is as under

SELECT * FROM sitemaster,usitemaster where sitemaster.siteno=usitemaster.siteno and sitemaster.branch='078' or sitemaster.branch='079' or sitemaster.branch='083' order by cname

I need to be able to use multiple OR's and thats what creates the problem.

Posted: Tue Mar 30, 2004 4:38 pm
by kettle_drum
Use ( and ) to seperate them:

(blah = blah AND blah1 = blah1) OR (blah 3 = blah3) OR (blah4 = blah4) OR (blah5 != blah5)