--- In [email protected], "rkw1956" <[EMAIL PROTECTED]> wrote:
>
> Hi all,
> 
> I have a table called "wines" and a table called "members".
> 
> I want to record the individual wines that a member would like to 
keep
> in a "shopping list"; this will be a permanent list which they can
> delete a wine from the their list or add one to it. This is to 
remind
> them of wines they might like to purchase in the future.
> 
> I guess we're talking about a one to many relationship (member 1,
> wines M) but I can't get my head round how I should do this - can
> anyone point me in the right direction?
> 
> TIA.
> 
> Richard
>

First you will need to add IDs to the wines and members tables
MemberID and WineID if not already there.

Second create a table we'll call shopping_list.
shopping_list will have 2 fields MemberID and WineID.

You can then search for what wines for a member using this SQl
SELECT Members.FirstName, Members.LastName, Wines.Wine
FROM (Members INNER JOIN shopping_list ON Members.membrID = 
shopping_list.MemberID) INNER JOIN Wines ON shopping_list.WineID = 
Wines.WineID
WHERE (((Members.FirstName)="first") AND ((Members.LastName)
="last"));

You can also see who want a particular wine using this SQL
SELECT Members.FirstName, Members.LastName, Wines.Wine
FROM (Members INNER JOIN shopping_list ON Members.membrID = 
shopping_list.MemberID) INNER JOIN Wines ON shopping_list.WineID = 
Wines.WineID
WHERE (((Wines.Wine)="red"));









------------------------ Yahoo! Groups Sponsor --------------------~--> 
Get Bzzzy! (real tools to help you find a job). Welcome to the Sweet Life.
http://us.click.yahoo.com/A77XvD/vlQLAA/TtwFAA/CefplB/TM
--------------------------------------------------------------------~-> 

The php_mysql group is dedicated to learn more about the PHP/MySQL web database 
possibilities through group learning.  
Yahoo! Groups Links

<*> To visit your group on the web, go to:
    http://groups.yahoo.com/group/php_mysql/

<*> To unsubscribe from this group, send an email to:
    [EMAIL PROTECTED]

<*> Your use of Yahoo! Groups is subject to:
    http://docs.yahoo.com/info/terms/
 


Reply via email to