> I think that would be a UNION.
> Also it would add extra rows to the count
> for each story with more than one keyword.
Scott, you're correct.
In an attempt to create a query that lists all the related
keywords of a
given keyword, I came up with this monstrosity:
SELECT name FROM keyword WHERE id IN (SELECT DISTINCT
keyword_id FROM
story_keyword WHERE story_id IN (SELECT story_id FROM
story_keyword,
keyword WHERE keyword_id = keyword.id AND keyword.name IN
('Oil')));
I imagine there has to be a more elegant solution. If so,
I'm all ears!
Chris
|