----- Original Message ----- From: "Paul DuBois" Sent: Thursday, September 18, 2003 8:17 PM Subject: Re: using OR in select statement with distinct results
> At 7:47 PM -0500 9/18/03, Sam Folk-Williams wrote: > >Hi, > > > >I keep having this fundamental problem. It seems like this should be > >easy enough, but whenever I have a query where I'm using OR in the > >WHERE clause and the query is performed on multiple tables, I get > >strange results. For example: > > > >SELECT t1.title, t2.auth_name FROM t1, t2, WHERE cat_id = 1 OR > >cat_id = 2 AND t1.auth_id = t2.auth_id > > You probably should use parentheses in your WHERE clause to explicitly > group terms the way you want them evaluated. Yeah, like WHERE (cat_id=1 OR cat_id=2) AND ... However, I just replied to say that it would be easier and cleaner looking to use IN: WHERE cat_id IN (1, 2) AND ... :-) Matt -- MySQL General Mailing List For list archives: http://lists.mysql.com/mysql To unsubscribe: http://lists.mysql.com/[EMAIL PROTECTED]