For Programmers: Free Programming Magazines  


Home > Archive > PHP SQL > February 2006 > Re: Joining many results from one table with one result from another









You are viewing an archived Text-only version of the thread. To view this thread in it's original format and/or if you want to reply to this thread please [click here]

 

Author Re: Joining many results from one table with one result from another
J.O. Aho

2006-02-23, 6:58 pm

Piotr Chmielewski wrote:
> I've got some lexicon-like application which stores data in 2 tables:
> lexicon( id, description ) and keywords(lexicon_id, keyword)
> This is flexible solution because there may be many keywords
> for one description. My problem is how to make ONE query, that
> will return description with given id, along with ALL keywords
> referencing to this description (keywords of course joined in
> one string, separated by a space or comma or any other character)
> Is it possible to achieve using MySQL 5? Maybe some subquery?
> I'll be grateful for any answer.


Do a select on keywords.keyword and left join lexicon

http://dev.mysql.com/doc/refman/5.0/en/join.html


//Aho
Sponsored Links







Also available: Server administration forum archive | Web Design forum archive | Software forum archive | Hardware reviews archive

Copyright 2008 codecomments.com