[EMAIL PROTECTED] ("Daren Cotter") wrote:

>I am having major troubles creating this query...ok here's some
>background info:
>
>I have three tables: members, which contains info about the member, such
>as city, state, zip, marital status, etc; interests, which stores just
>an interest_id and name; and member_interests, which stores just
>member_id and interest_id.
>
>What I need to do is create a query that selects certain members from
>the DB depending on certain demographics. For example, the query might
>need to select all members from the DB where their country is USA,
>Marital Status is Single, and have "Golf" selected as an interest. The
>first two are no problem...but, is there any way to create ONE query
>that would validate all the info stored in members table, as well as the
>member_interests table? And if not, can someone provide a sample
>solution method?

Yes, double inner join .....

Assuming people is the first table, links sits in the middle, and
categories is a list of interests ......

SELECT People.FirstName, People.LastName, People.MaritalStatus,
People.MobilePhone, Categories.CategoryName
FROM (People INNER JOIN links ON People.AddressID = links.persid)
INNER JOIN Categories ON links.catid = Categories.CategoryID;

Rgds
Denis
-- 
Denis McMahon / +44 7802 468949 / [EMAIL PROTECTED]
sulfnbk is not a virus, see the symantec virus encyclopaedia!
Now restocking killfile, new entrants welcome: trolls, spam, 
xpost cascades, OT ads, top posters & terminally clueless!

---------------------------------------------------------------------
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

Reply via email to