萬盛學電腦網

 萬盛學電腦網 >> 數據庫 >> mssql數據庫 >> orderby與groupby同時使用方法

orderby與groupby同時使用方法

  1.

  SELECT Sale.BaoBeiName, Count(*) AS 銷售量

  FROM Sale

  GROUP BY Sale.BaoBeiName order by Count(*) desc;

  2.

  SELECT Sale.BaoBeiName, sum(*) AS 合計 FROM Sale

  GROUP BY Sale.BaoBeiName order by sum(*) desc;

copyright © 萬盛學電腦網 all rights reserved