I have a main table for content, and several subset tables for different
types of content (articles, interviews, reviews, etc.).

I'm building a 'master' query that will retrieve all content info according
to certain criteria (maybe browsing, maybe listing content by a certain
contributor). So the content table is:

    itemID
    title
    ownerID (FK from 'contributors')
    type (references name of subset table)
    activated
    etc.

And, for example, the interviews table is:

    itemID (FK from 'content')
    subject
    intDate

And the reviews table is:

    itemID (FK from 'content')
    rvwType (book, film, etc.)

How do I do and outer join to grab all activated content, plus the subset
info according to the content type? Obviously I could grab all activated
content and query the DB again for each record to get subset table info
according to type, but naturally I want to do it all in one query. I know
the basic outer join syntax, but what about this? Would it be:

    SELECT c.itemID, c.title, c.ownerID, c.type, i.subject, i.intDate,
r.rvwType
    FROM content c LEFT JOIN interviews i, content c LEFT JOIN reviews r
    ON c.itemID = i.itemID
    AND c.itemID = r.itemID
    WHERE c.activated = 1

The FROM/AND/ON/WHERE conjunctions all look a little off whichever way I try
it. I've not tested the code yet, I just wondered if anyone had the answer
off the top of their head to save me some stress!

TIA,

- Gyrus

~~~~~~~~~~~~~~~~~~~~~~~~~~~~
- [EMAIL PROTECTED]
work: http://www.tengai.co.uk
play: http://www.norlonto.net
- PGP key available
~~~~~~~~~~~~~~~~~~~~~~~~~~~~

______________________________________________________________________
Signup for the Fusion Authority news alert and keep up with the latest news in 
ColdFusion and related topics. http://www.fusionauthority.com/signup.cfm
FAQ: http://www.thenetprofits.co.uk/coldfusion/faq
Archives: http://www.mail-archive.com/[email protected]/
Unsubscribe: http://www.houseoffusion.com/index.cfm?sidebar=lists

Reply via email to