PL / SQL:我该如何编写这个程序?

时间:2012-10-16 14:23:46

标签: plsql

我有3个专栏:'GAME''PLAYER_ID''MINUTES_PLAYED'

看起来像这样:

GAME     ID     MINUTES_PLAYED
12550788  229569   23
12500788  393438   4
12500788  458730   25
12500782  229569   10

我想找到每场比赛的总分钟数,即

ID       TOTAL_MINUTES
229569   33
.
.
.

提前谢谢!

3 个答案:

答案 0 :(得分:1)

select id, sum(minutes_played) from tableName group by id

答案 1 :(得分:1)

SELECT ID, SUM(MINUTES_PLAYED)
FROM MYTABLE
GROUP BY ID

答案 2 :(得分:0)

只需添加它们:

SELECT ID, SUM(MINUTES_PLAYED) AS TOTAL_MINUTES
FROM table GROUP BY ID