SQL合并相同数据
表A
KID CID PF COLT SIZET QUANTITY RKCODE
1 1 AA WHITE S 30 RK070920001
1 1 BB WHITE M 30 RK070920001
1 1 CC WHITE S 30 RK070920001
1 1 SS WHITE S 10 RK070920002
1 1 CD WHITE M 40 RK070920002
1 1 QD WHITE L 30 RK070920002
想得到以下表SELECT语句怎么写
KID CID RKCODE QUNATITY
1 1 RK070920001 90
1 1 RK070920002 80
------解决方案--------------------select KID, CID, RKCODE ,sum(QUANTITY )as QUANTITY from t group by KID, CID, RKCODE
------解决方案--------------------select KID,CID,RKCODE,sum(QUNATITY) QUNATITY
from a
group by KID,CID,RKCODE