MYSQL 表记录,其中index是主键
index interface internal_ip byte_no pkt_no conn_num real_time
1 eth0 192.168.11.68 37989 137 550 2013-08-26 11:23:01
2 eth1 192.168.11.68 17218 166 550 2013-08-26 11:23:01
。需要的查询结果:
对每行记录,字段 byte_no,pkt_no求和 得出total, 并按照total降序排列,取前七个记录,sql怎么写啊?mysqlsql
index interface internal_ip byte_no pkt_no conn_num real_time
1 eth0 192.168.11.68 37989 137 550 2013-08-26 11:23:01
2 eth1 192.168.11.68 17218 166 550 2013-08-26 11:23:01
。需要的查询结果:
对每行记录,字段 byte_no,pkt_no求和 得出total, 并按照total降序排列,取前七个记录,sql怎么写啊?mysqlsql
from tb
order by total desc
limit 7;