RE: three-way join

2002-01-24 Thread Roger Baklund
* mike vogel > thanks to all respondents! one more thing, i have 2 foreign keys in the > bridge table, but not a primary key. is a primary key in the bridge > necessary for this type of join to work? thanks again. Make the two foreign keys the primary key for this table, that way you prevent the

Fwd: three-way join

2002-01-23 Thread mike vogel
2002 03:25:06 PM US/Pacific > To: mike vogel <[EMAIL PROTECTED]>, [EMAIL PROTECTED] > Subject: RE: three-way join > > > > create table magazine > (Mag_id int primary key, > Name char(30)); > > create table customer > (cust_id int primary key, > name char

RE: three-way join

2002-01-23 Thread Roger Karnouk
nner join customer c on (c.cust_id = b.cust_id) where m.Name = 'carmag'; -Original Message- From: mike vogel [mailto:[EMAIL PROTECTED]] Sent: Wednesday, January 23, 2002 5:51 PM To: [EMAIL PROTECTED] Subject: three-way join i understand that creating a M:N relationship in mysql

RE: three-way join

2002-01-23 Thread Roger Baklund
* mike vogel > i understand that creating a M:N relationship in mysql involves 3 > tables, one of which being a bridge, but how do i join the first and > third tables by way of a bridge? The same way you do a M:1 'bridge', but one single table is the M-part of both 'bridges'. > example: a tab

Re: three-way join

2002-01-23 Thread Christopher Thompson
Thanks, David. He is of course correct if you need to look up the name of the subscriber. If you already know the subscriber's ID, you can modify the query to look more like mine. In any case, try to avoid large joins. :) At 03:08 PM 1/23/2002 -0800, David Turner wrote: >Sorry not real fami

Re: three-way join

2002-01-23 Thread David Turner
Sorry not real familar with MYSQL syntax yet but I think you'll be able to translate. select m.magazinename from s,m,b where s.name = 'fred' and s.id=b.subscriberid and m.id=b.magazineid ; On Wed, Jan 23, 2002 at 03:59:11PM -0700, Christopher Thompson wrote: > At 02:51 PM 1/23/200

Re: three-way join

2002-01-23 Thread Christopher Thompson
At 02:51 PM 1/23/2002 -0800, you wrote: >i understand that creating a M:N relationship in mysql involves 3 tables, >one of which being a bridge, but how do i join the first and third tables >by way of a bridge? > > example: a table of subscribers and a table of magazines with a bridge > in th

three-way join

2002-01-23 Thread mike vogel
i understand that creating a M:N relationship in mysql involves 3 tables, one of which being a bridge, but how do i join the first and third tables by way of a bridge? example: a table of subscribers and a table of magazines with a bridge in the middle. how do i select just the magazines fr