我在数据库中有一个表:
---------------------------------------
- id - fileid - sentences -
---------------------------------------
- 1 - 1 - I want eat . -
- 2 - 1 - I wanna eat banan . -
- 3 - 2 - I wanna eat apple . -
- 4 - 2 - I wanna sleep . -
---------------------------------------
我想收集句子取决于'fileid'。结果是:
I want eat . I wanna eat banan .
和
I wanna eat apple . I wanna sleep .
如何做假设我不知道fileid?感谢
答案 0 :(得分:2)
我想你只想要group_concat()
:
select group_concat(sentences order by id separator '')
from table t
group by fileid