> SELECT a.* FROM company a, employee b WHERE a.id=b.cid AND b.name='joe' OR > b.name='bill'; > however, this would return any companies that has ONLY one Bill or one Joe > .. I only want companies that > have BOTH. It also returns one row with the company per name it found, so > you can imagine I got confused > when it found 2000 rows when my list of companies is 50 rows =) Basically, SELECT DISTINCT ..... will give you just one row per company found. > > what I'd like to do is find the > company who has both bill and joe > > I tried: > SELECT a.* FROM company a, employee b WHERE a.id=b.cid AND b.name='joe' AND > b.name='bill'; Try: SELECT DISTINCT a.* FROM company a, employee b, employee c WHERE a.id=b.cid AND a.id=c.cid WHERE b.name='joe' AND c.name='bill' > > But I realized this is all wrong cause the same cell cannot be both Joe and > Bill =) > > mysql query smallint HTH
__ / \\ @ __ __ @ Adolfo Bello <[EMAIL PROTECTED]> / // // /\ / \\ // \ // Bello Ingenieria S.A, Presidente / \\ // / \\/ // // / // cel: +58 416 609-6213 /___//// / <_/\__\\//__/ // fax: +58 212 952-6797 www.bisapi.com // pager: www.tun-tun.com (# 609-6213) --------------------------------------------------------------------- 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