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 <[EMAIL PROTECTED]> To unsubscribe, e-mail <[EMAIL PROTECTED]> Trouble unsubscribing? Try: http://lists.mysql.com/php/unsubscribe.php