Thursday, December 17, 2009

CONCAT value in GROUP BY in mysql

You can actually concat-ing values returned by group by query by doing this:

SELECT GROUP_CONCAT(DISTINCT name ORDER BY name SEPARATOR ',')
FROM animals
WHERE type IN ('bird',''reptile)
GROUP BY type

No comments:

Post a Comment