34,590
社区成员
发帖
与我相关
我的任务
分享
id type amount
1 A 10
2 B 20
3 c 30
4 A 40
5 c 70
6 d 60
type amount f1
A 50 2
B 20 1
C 100 2
d 60 1
select
[type],
sum(amount) [amount],
count(*) as [f1]
from
#t
group by
[type]
SELECT [TYPE],SUM([AMOUNT]) AMOUNT,COUNT(1) F1
FROM #t
GROUP BY [TYPE]
SELECT type,SUM(amount) AS amount,COUNT(1) AS f1
FROM #T
GROUP BY type
select [type],sum(amount) amount,count(*) as f1
from #t
group by [type]