2013-04-19 1 views
0

다음과 같다 : - 이제는 SQL 그룹은 MySQL의에서 그룹의 모든 요소 내가 MySQL의에서 테이블 스키마가 있다고 가정

ipsrc,ipdst,framelen 

나는 다음과 같은 경우 : -

select max(framelen) from tblname group by ipsrc,ipdst 

내가 얻을 고유 한 ipsrc : ipdst 쌍마다 프레임 렝의 최대 값.

만약 내가 각 framelen을 각각 ipsrc:ipdst 쌍으로 원한다면 ???

SQL을 사용하여 어떻게 얻을 수 있습니까?

답변

1

사용 GROUP_CONCAT()

select group_concat(framelen) 
from tblname 
group by ipsrc, ipdst 

는 구분 모든 framelen 쉼표를 나열합니다.

0

이 시도 :

select framelen from tblname group by ipsrc,ipdst,framelen 
관련 문제