需求实现:
mysql> select log_day,substring_index(group_concat( concat(site,':',pv_sum) order by pv_sum desc separator '|'),'|',5) from log_report_new_site group by log_day;
+------------+------------------------------------------------------------------------------------------------------------------+
| log_day | substring_index(group_concat( concat(site,':',pv_sum) order by pv_sum desc separator '|'),'|',5) |
+------------+------------------------------------------------------------------------------------------------------------------+
| 2012-11-07 | xs8.cn:10828866|hongxiu.com:8064218|zongheng.com:3687797|meishichina.com:1384982|21zw.net:908396 |
| 2012-11-08 | chaojiqiangbing.com:109837|ekan.cc:106120|cngaosu.com:39203|weiyikai.com:11520|ufang.com:7799 |
| 2012-11-09 | caihongwenxue.com:1219373|geiliwx.com:224934|haoqi99.com:203784|120ask.com:152001|xn--1314-3u9g422p1fe.com:14302 |
| 2012-11-10 | 66163.com:112539|7y7.com:70521|419.sh:4107|361av.com:2860|zhimaquan.com:2170 |
| 2012-11-11 | 360disk.com:19334|siwajia.com:4364|hao592.net:3619|rwlbnt.com:2942|w3cfuns.com:1153 |
| 2012-11-12 | 91.com:159382|hd208.com:39905|33mm.cc:27438|seseoua.com:25272|umimi.cn:18948 |
+------------+------------------------------------------------------------------------------------------------------------------+