以不同顺序返回的MySQL数据
我有一张桌子以不同顺序返回的MySQL数据,mysql,Mysql,我有一张桌子 sender| recepient |message type01| 923007957585 |same msg type01| 923018976543 |same msg type01| 923037865456 |same msg type02| 923456812536 |type 2 msg type03| 923111111111 |type 3 msg 想得到结果吗 recepient=923007957585923018976543
sender| recepient |message
type01| 923007957585 |same msg
type01| 923018976543 |same msg
type01| 923037865456 |same msg
type02| 923456812536 |type 2 msg
type03| 923111111111 |type 3 msg
想得到结果吗
recepient=923007957585923018976543923037865456和相同的消息
recepient=923456812536和类型2消息
recepient=9231111111&type 3 msg您可以使用group\u concat:
我能理解你想说的,你需要找出一个发送者到多个接收者的关系,即一对多的关系。。。 可能您可以使用“按发件人分组”和 把条款放在一起 戈尔丹是对的。 //按发件人使用分组
select group_concat(recipient) as recipients, message
from table t
group by sender;
请分享您的尝试。您的预期结果非常不清楚。请具体说明您想要的格式、列中的值,或者如果这是PHP数据类型、类型和排列方式。logan是正确的。问题是如何区分它们。如何使用fetch数组获取结果??获取数据后如何区分结果??我不知道您在问什么。
select group_concat(recipient) as recipients, message
from table t
group by sender;