[thelist] Selecting two distincts

rudy r937 at interlog.com
Sun May 5 23:12:01 CDT 2002


> How could this be combined into one query?
> Would it be best to leave it as two separate queries?

hi joel

depends on your reason for wanting them combined

in the first query, you're keying on a particular weblog record, then
finding all loggenretlks linked to it, and all genres linked to those
loggenretlks

in the second query, you're keying on the same weblog record, but then
finding all logbandtlks linked to it, and all bands linked to those
logbandtlks

a more complex join would probably not make sense, unless the loggenretlks
and logbandtlks are also related to each other

you could combine the queries in a UNION, but then you'd have to
distinguish between the genres and bands, which would all come back in the
same column -- probably not what you want

if making one call to the database instead of two is your reason for
asking, leave them as two

rudy




More information about the thelist mailing list