Mysql problem

Questions about the MySQL, PostgreSQL, and most other databases, as well as using it with PHP can be asked here.

Moderator: General Moderators

Post Reply
User avatar
sulen
Forum Commoner
Posts: 79
Joined: Wed Jul 09, 2003 4:55 pm
Location: los angeles
Contact:

Mysql problem

Post 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.
kettle_drum
DevNet Resident
Posts: 1150
Joined: Sun Jul 20, 2003 9:25 pm
Location: West Yorkshire, England

Post by kettle_drum »

Use ( and ) to seperate them:

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