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 the middle. how do i select just the magazines fred is subscribed to? > thanks in advance and sorry if this is a confusing question.
Table S (subscribers) ID Name Table M (magazines) ID MagazineName Table B (bridge) SubscriberID MagazineID Sample data in S: 1 - Fred 2 - John 3 - Chris Sample data in M: 1 - Playboy 2 - Computer Gaming World 3 - Maxim Sample data in B: 1 - 1 1 - 3 2 - 1 2 - 2 3 - 2 How do you select just the magazines Fred subscribes to? SELECT MagazineName FROM M, B WHERE M.ID = B.MagazineID AND B.SubscriberID = (Fred's ID); Or something. My SQL is a little rusty, it's been about six months since I used it last. --------------------------------------------------------------------- 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