Don’t know why I never thought to google for something like this before. There probably aren’t too many good uses for it, but it saved me a bunch of time today so I thought I’d share:
Running a query like the one below, would return all the values from my sub-select as a comma delimited list so this…
SELECT products.namename,
GROUP_CONCAT(options.option) AS options
FROM products
INNER JOIN options
ON options.productID = products.productID
Could return something like this:
NAME | OPTIONS |
---|---|
t-shirt | green, blue, red, small, medium, large |
hat | cowboy |
0 comments:
Post a Comment