Warning: file_get_contents(/data/phpspider/zhask/data//catemap/8/mysql/64.json): failed to open stream: No such file or directory in /data/phpspider/zhask/libs/function.php on line 167

Warning: Invalid argument supplied for foreach() in /data/phpspider/zhask/libs/tag.function.php on line 1116

Notice: Undefined index: in /data/phpspider/zhask/libs/function.php on line 180

Warning: array_chunk() expects parameter 1 to be array, null given in /data/phpspider/zhask/libs/function.php on line 181
以不同顺序返回的MySQL数据_Mysql - Fatal编程技术网

以不同顺序返回的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;