本文介绍了如何连接多于两行的mysql的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!
问题描述
我想基于id将一行连接起来,
我使用了group_concat(ID分隔符``,'')
但没有得到..
如果您知道可以帮助我.
谢谢&问候..
Honey ..
i want to concatenate rows in a single row basing on the id,
i used group_concat(ID separator '','')
but not getting..
if u know help me.
Thanks & Regards..
Honey..
推荐答案
If you have the table called "table1" with following data,
fID field1
1 Data1
2 Data2
3 Data3
and you want data in one row like:
Data1, Data2, Data3
then you can use the following query:
select fID, group_concat(field1 separator ', ') from table1 group by fID;
这篇关于如何连接多于两行的mysql的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持!