Wednesday, February 13, 2013

[MYSQL] 分組 "GROUP BY"


列出不重覆的欄位值

SELECT * FROM mytable GROUP BY kind

搭配SUM()可以計算分組之後的總和

SELECT SUM(money) FROM mytable GROUP BY kind

No comments:

Post a Comment