怎样写group by处理交叉组合的统计?
实例表结构和记录如下:
source dest length
192.168.5.1 192.168.2.3 27
192.168.5.1 192.168.2.5 466
192.168.5.2 192.168.2.5 2389
192.168.5.1 192.168.2.3 74
192.168.5.3 192.168.2.137 6890
192.168.5.2 192.168.2.137 389
以上表为例,组合就有
source=192.168.5.1 and dest=192.168.2.3
source=192.168.5.1 and dest=192.168.2.5
source=192.168.5.1 and dest=192.168.2.137
source=192.168.5.2 and dest=192.168.2.3
source=192.168.5.2 and dest=192.168.2.5
source=192.168.5.2 and dest=192.168.2.137
source=192.168.5.3 and dest=192.168.2.3
source=192.168.5.3 and dest=192.168.2.5
source=192.168.5.3 and dest=192.168.2.137
要计算9种组合的记录数和length
需要按照这些不同的组合分别统计其记录数和length总量,怎么写语句?