* Andreas Ahlenstorf > I've got a table with articles and a table with categories. Using a > 'temporary' table it's easy to assign multiple categories to an > article. The insert is no problem, because I can perform two queries, > but for the output I get one row for every every category. But i like > to get one row with every category name in a field, separated by a > special character or something similar. Has anyone an idea to do that > without a extra query for each article?
>From version 4.1 you can use the GROUP_CONCAT() function, I think it does exactly what you are asking: <URL: http://www.mysql.com/doc/en/GROUP-BY-Functions.html#IDX1434 > For versions 3.x and 4.0, I think the easiest way is to use some programming language, but it may be possible to do it using mysql only, in some cases. Is there a limited number of categories per article? Say, max five? Then you could do five LEFT JOINS and use CONCAT() to glue it all togheter into one column in the result. -- Roger -- MySQL General Mailing List For list archives: http://lists.mysql.com/mysql To unsubscribe: http://lists.mysql.com/[EMAIL PROTECTED]