Hi Just try this
select distinct(a.id) from test a , test b where a.code = 23 and b.code = 45 and a.id = b.id Regards, -Arul ----- Original Message ----- From: "Robert Gehrig" <[EMAIL PROTECTED]> To: "MySQL List" <[EMAIL PROTECTED]> Sent: Wednesday, December 04, 2002 10:52 PM Subject: Select Problem > Hi all > > I have a detail table that has multiple records associated with an ID number > Both fields are integers > > E.G. > > Id Code > 4 23 > 4 27 > 34 23 > 34 45 > 34 28 > > What I need to find is the Id where the code is 23 and 45 for the same Id (the result in this case would be 34) > > How do I do this with a SQL query > > Thanks > > Robert Gehrig > Webmaster at www.gdbarri.com > > e-mail: [EMAIL PROTECTED] > > > > > --------------------------------------------------------------------- > 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 > --------------------------------------------------------------------- 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