List:General Discussion« Previous MessageNext Message »
From:Kevin Waterson Date:September 24 2007 10:33pm
Subject:Re: bookmarks and keywords
View as plain text  
This one time, at band camp, Baron Schwartz <baron@stripped> wrote:

> > I wish to select all bookmark_title and bookmark_url that have the same keywords
> as
> > the bookmark_url 'http://www.redhat.com. I do this..
> > mysql> SELECT child.bookmark_id, child.bookmark_title, child.bookmark_url
> FROM bookmarks AS child join bookmarks AS parent ON parent.bookmark_keyword =
> child.bookmark_keyword WHERE child.bookmark_url='http://www.redhat.com' GROUP BY
> child.bookmark_keyword;
> > 
> 
> That query is right.

> > But this returns..
> > +-------------+----------------+-----------------------+
> > | bookmark_id | bookmark_title | bookmark_url          |
> > +-------------+----------------+-----------------------+
> > |           4 | and four       | http://www.redhat.com |
> > |           8 | finally        | http://www.redhat.com |
> > +-------------+----------------+-----------------------+
> 
> But, the JOIN table from which those columns come actually has the 
> columns you want from the parent table as well.  It's just that you're 
> selecting the child columns.

Im not sure I follow, the results should be those with id's of 1, 3, 4, 5, 6, 7, 8

and If I chose http://www.php.net that has only the keyword of "php" then the results
would be 1,3,5, and 8

Kind regards
Kevin

-- 
"Democracy is two wolves and a lamb voting on what to have for lunch. 
Liberty is a well-armed lamb contesting the vote."
Thread
bookmarks and keywordsKevin Waterson24 Sep
  • Re: bookmarks and keywordsBaron Schwartz24 Sep
    • Re: bookmarks and keywordsSebastian Mendel24 Sep
    • Re: bookmarks and keywordsKevin Waterson25 Sep
      • Re: bookmarks and keywordsBaron Schwartz25 Sep
        • Re: bookmarks and keywordsSebastian Mendel25 Sep
        • Re: bookmarks and keywordsSebastian Mendel25 Sep
  • Re: bookmarks and keywordsSebastian Mendel24 Sep
    • Re: bookmarks and keywordsBaron Schwartz24 Sep
      • Re: bookmarks and keywordsSebastian Mendel24 Sep