On Sat, 29 Sep 2001, Benjamin Pflugmann wrote:

> Hi.
> 
> On Sat, Sep 29, 2001 at 12:43:25PM +0530, [EMAIL PROTECTED] wrote:
> [...]
> > I am trying the below sql statement:
> > select na.id as naid, na.nid, na.date from newsarticles na, newscodes nc
> > where na.nid=nc.id and na.nid=1 or na.nid=3 or na.nid=9 order by na.date;
> 
> This is aquivalent of
> 
> SELECT         na.id as naid, na.nid, na.date
> FROM   newsarticles na, newscodes nc
> WHERE          ((na.nid=nc.id AND na.nid=1) OR na.nid=3) OR na.nid=9
> ORDER BY na.date;
> 
> whereas you probably meant
> 
> WHERE          na.nid=nc.id AND (na.nid=1 OR na.nid=3 OR na.nid=9)
> 
> which also can be written as 
> 
> WHERE          na.nid=nc.id AND na.nid IN (1, 3, 9)

Interesting.  I never knew that I could you this sql statement.  BTW, I
I used left join and it works now.

Thanks

Adrian


---------------------------------------------------------------------
Before posting, please check:
   http://www.mysql.com/manual.php   (the manual)
   http://lists.mysql.com/           (the list archive)

To request this thread, e-mail <[EMAIL PROTECTED]>
To unsubscribe, e-mail <[EMAIL PROTECTED]>
Trouble unsubscribing? Try: http://lists.mysql.com/php/unsubscribe.php

Reply via email to