문제

Anyone knows if String Aggregation in sqlite is possible? If i have an animal column with 5 rows/datas, how can i combine them so that the output would be in one field 'dog','cat','rat','mice','mouse' as animals

Thanks

도움이 되었습니까?

해결책

You're looking for something like the following:

select group_concat(animal) from animals;

This will return something like the following:

dog,cat,rat,mice,mouse

If you don't want to use a comma as the separator, you can add your own separator as a second parameter:

select group_concat(animal, '_') from animals;

which will return:

dog_cat_rat_mice_mouse
라이센스 : CC-BY-SA ~와 함께 속성
제휴하지 않습니다 StackOverflow
scroll top