[thelist] SQL Madness! Many-to-many selection

Joshua Olson joshua at alphashop.net
Fri Aug 17 16:29:47 CDT 2001


----- Original Message -----
From: "Anthony Baratta" <Anthony at Baratta.com>
To: <thelist at lists.evolt.org>
Sent: Friday, August 17, 2001 5:21 PM
Subject: Re: [thelist] SQL Madness! Many-to-many selection


: At 02:11 PM 8/17/2001, you wrote:
: >I find that creating an intermediate table that has a one to many
: >relationship to each of the tables in the many to many relationship helps
: >and will be quicker when processing the query. You can use triggers to
: >automatically update the intermediate table when other actions are
: >performed on the other tables.
:
: Why not a "view" and not have to worry about triggers?

Sometimes the relationship between an item and another, in this case an
event and it's categories, may need more information than just the binary,
"am I in it, or not?"  If you need to store properties about the
relationship, such as "date added", "who added it", and in a multi-site
environment, "for which site does this apply?", then an intermediary table
is the only way to go.

In this case, I have the intermediary table, but am trying to find a simpler
query--some sort of SQL trick that only Rudy (where the heck are ya??) would
know--to not have to use thrice embedded queries and the alleviate some of
my speed concerns.

-joshua





More information about the thelist mailing list