我正在使用以下mysql查询来分组referrersource。
SELECT referrersource,count(referrersource) as counts
FROM request_events
where referrersource!=''
AND landingpage_collectionid=1
group by referrersource
在这里,我想按结果集按升序排序。如何更改我的上述查询。请提供任何建议
答案 0 :(得分:1)
添加ORDER BY counts DESC
?
答案 1 :(得分:1)
SELECT referrersource,count(referrersource) as counts
FROM request_events
where referrersource!=''
AND landingpage_collectionid=1
group by referrersource
ORDER BY 2
答案 2 :(得分:0)
添加ORDER BY子句。
SELECT referrersource
,count(referrersource) as counts
FROM request_events
where referrersource!=''
AND landingpage_collectionid=1
group by
referrersource
order by
2
答案 3 :(得分:0)
只需添加ORDER BY
子句,例如
ORDER BY count(referrersource)