[英]Sql group by extract all elements of a group in mysql
假设我在mysql中有一个表架构,如下所示:
ipsrc,ipdst,framelen
现在,如果我执行以下操作:
select max(framelen) from tblname group by ipsrc,ipdst
对于每个唯一的ipsrc:ipdst对,我都会得到最大的framelen。
如果我想要每个ipsrc:ipdst
对中的所有framelen
ipsrc:ipdst
?
我们如何使用sql来获得?
select group_concat(framelen)
from tblname
group by ipsrc, ipdst
列出所有framelen
逗号分隔的framelen
逗号。
尝试这个:
select framelen from tblname group by ipsrc,ipdst,framelen
声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.