From: John McCaskey Date: February 27 2006 6:44pm Subject: RE: Connecting to queries into one List-Archive: http://lists.mysql.com/mysql/195213 Message-Id: <973E7C4A6AFAC545BBB4A6173118888D01389038@mail01.ips.corp> MIME-Version: 1.0 Content-Type: text/plain; charset="us-ascii" Content-Transfer-Encoding: quoted-printable SELECT consumers.id FROM consumers, cases=20 WHERE=20 consumers.id=3Dcases.consumers_id=20 AND consumers.date_of_birth =3D ?=20 AND cases.last_name =3D ? AND cases.first_name =3D ? John A. McCaskey -----Original Message----- From: Courtney Braafhart [mailto:courtney.braafhart@stripped]=20 Sent: Monday, February 27, 2006 10:31 AM To: mysql@stripped Subject: Connecting to queries into one MY GOAL =09 To collect any consumers.id WHERE date of birth, last name and =20 first name matches what was entered by the user. The trick is that =20 date of birth lives in the consumer table and last name and first =20 name lives in the cases table (which can be joined to consumers by =20 consumers.id and cases.consumer_id). Can anyone think of way to do this in one mysql statement instead =20 of doing a loop? I am thinking it would work something like this: SELECT consumers.id FROM consumers WHERE date_of_birth =3D ? AND =20 consumer.id =3D (SELECT consumer_id FROM cases WHERE last_name =3D ? AND full_first_name =3D ? ) Is there a way to form the above statement in MYSQL? MY HOPE That there is a really obvious solution to this question and that I =20 am simply suffering from a case of the Mondays! Thanks in advance! Courtney Braafhart --=20 MySQL General Mailing List For list archives: http://lists.mysql.com/mysql To unsubscribe: http://lists.mysql.com/mysql?unsub=3Djohnm@stripped