开发者

mysql merge rows if id = the same

I have about 20 entires (rows) in my db with matching id's, is there any query I can do that will merge the rows if the id is the same?

luckily there is no chance that a cell will replace each other, they will simply need to merge.

eg..

id    c1    c2    c3    c4    c5    c6    c7    c8    c9    c1开发者_JAVA百科0

3     1
3           4           3 


You just have to group using any grouping function

select  id,max(c1) as c1,max(c2) as c2,max(c3) as c3,...
from    [Table]
group by Id


select group_concat(c1), group_concat(c2) ....
0

上一篇:

下一篇:

精彩评论

暂无评论...
验证码 换一张
取 消

最新问答

问答排行榜