5 messages in com.mysql.lists.mysqlConnecting to queries into one
FromSent OnAttachments
Courtney Braafhart27 Feb 2006 10:30 
phpninja27 Feb 2006 10:35 
Taiyo27 Feb 2006 10:40 
John McCaskey27 Feb 2006 10:44 
Peter Brawley27 Feb 2006 12:06 
Subject:Connecting to queries into one
From:Courtney Braafhart (cour@vr.ne.gov)
Date:02/27/2006 10:30:25 AM
List:com.mysql.lists.mysql

MY GOAL

To collect any consumers.id WHERE date of birth, last name and first name matches what was entered by the user. The trick is that date of birth lives in the consumer table and last name and first name lives in the cases table (which can be joined to consumers by consumers.id and cases.consumer_id).

Can anyone think of way to do this in one mysql statement instead of doing a loop?

I am thinking it would work something like this:

SELECT consumers.id FROM consumers WHERE date_of_birth = ? AND consumer.id = (SELECT consumer_id FROM cases WHERE last_name = ? AND full_first_name = ? )

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 am simply suffering from a case of the Mondays!

Thanks in advance!