SQL表组按查询员工表

时间:2014-05-14 13:56:57

标签: sql sql-server-2008 sqlite tsql

我有一张如下表格,我想按员工分组。

Employee    ID      AMOUNT
ABC         101     200
ABC         101     2365
ABD         222     5544
ABC         101     83013
ABD         222     6545

我想看看

Employee    id      amount
Abc         101     85578
Abd         222     12089

2 个答案:

答案 0 :(得分:1)

Select employee, ID, sum(amount) as Amount
FROM TableName
group by Employee, ID

答案 1 :(得分:0)

看起来您需要的只是SUM()

select employee, id, sum(amount)
from yourtable
group by employee, id