嗨大家这是我的桌子叫“SAM”
@H_403_9@解决方法
ID | S_Date | S_MK | TID | Value | =============================================== 1 | 2012-12-11 | 1 | 112 | 23 | 2 | 2012-12-11 | 2 | 112 | 3 | 3 | 2012-12-11 | 1 | 113 | 22 | 4 | 2012-12-11 | 3 | 114 | 2 |
这应该是我的预期结果:具有相同T_ID的列“值”的总和:
S_Date | TID | sum(Value)| =============================== 2012-12-11 | 112 | 26 | 2012-12-11 | 113 | 22 | 2012-12-11 | 114 | 2 |
select S_Date,TID,sum(Value) from SAM group by S_Date,TID