[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
Re: QUICK HELP, two selects, maybe nested.
I looked that up and IN is an OR ... correct ?
Would be like saying:
Show me the records where departmentid = 142 OR departmentid = 368
I did however find this:
select * from departmentuser r1, departmentuser r2 where
r1.userid=r2.userid and r1.departmentid=368 and r2.departmentid=142;
Thanks for the help!
PS Though my searching i still have not found anything on IF statements in SQL... i'm sure there is some, i just can't find any examples. Anyone give me one or two?
>>> Sinisa Milivojevic <sinisa@xxxxxxxxx> 12/01/01 11:02am >>>
>Corey Kaye writes:
> Currently i'm selecting all the users with 368 and running through a loop and checking to
> see if the returned list of userid also have 142. This takes about 20sec as this is a BIG list !
>
Would this query do what you need ??
SELECT userid from departmentuser where departmentid IN (142,368);
---------------------------------------------------------------------
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 <mysql-thread92833@xxxxxxxxxxxxxxx>
To unsubscribe, e-mail <mysql-unsubscribe-treed=ultraviolet.org@xxxxxxxxxxxxxxx>
Trouble unsubscribing? Try: http://lists.mysql.com/php/unsubscribe.php
This mailing list archive is a service of Copilot Consulting.