[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
QUICK HELP, two selects, maybe nested.
Looking though the docs. MySQL does not support nested selects but i'm looking for a way to speed up my PHP.
This is what i have:
CREATE TABLE departmentuser (
userid int(10) unsigned zerofill default NULL,
departmentid int(10) unsigned zerofill default NULL,
KEY userid_departmentid(userid,departmentid)
);
What i need to do is select out of this table all the userid's that have a departmentid of 368 AND 142.
What is the best way to do this?
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 !
PLEASE HELP !!!!
PS I've never done it but can you use IF statements in MySQL ?
---------------------------------------------------------------------
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-thread92826@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.