3

Possible Duplicate:
SQL: Aggregating strings together

Hi, I have some data which looks like this for example:

TYPE     FOOD
Fruit    Orange
Fruit    Apple
Fruit    Pear
Vegetable  Carrot
Vegetable  Cabbage

And i want to write a query to give group by the "TYPE" column and concatenate the values in the "FOOD" column as a comma separated list, so the results would be:

Fruit  Orange,Apple,Pear
Vegetable Carrot,Cabbage

How would i do this?

Thanks A

Community
  • 1
  • 1
user555265
  • 493
  • 2
  • 7
  • 18

0 Answers0