I have the following table:
|animal | name |
|----------------|
|dog | Fido |
|----------------|
|dog | Spot |
|----------------|
|dog | Lassie |
|----------------|
|cat | Sue |
|----------------|
|cat | Ace |
|----------------|
|cat | Felix |
|----------------|
|pig | Porky |
|----------------|
|pig | Arnold |
|----------------开发者_开发问答|
I need an SQL query that will return the following
dog | Fido, Spot, Lassie
cat | Sue, Ace, Felix
pig | Porky, Arnold
select animal, group_concat(name)
from your_table
group by animal
精彩评论