SELECT * FROM (SELECT country, sum(id) as cnt FROM mygroup GROUP BY country WITH rollup) t ORDER BY cnt;

參考網址: http://www.sqlusa.com/bestpractices2005/subtotaltotalgrandtotal/

文章標籤
全站熱搜
創作者介紹
創作者 jeffath 的頭像
jeffath

jeffath的部落格

jeffath 發表在 痞客邦 留言(0) 人氣(120)