下图显示了一组带有列标题的结果:
TotalEnquires Commission TotalBusinessWritten TotalPaidOut1 formname
我需要按formname
进行分组,并获取SUM
的每个分组列的totalenquires, commission, totalbusinesswrittenm, totalpaidout1
有人可以帮忙吗?
答案 0 :(得分:1)
你的问题是什么?
SELECT formname, SUM(TotalEntries), SUM(TotalBusinessWritte), SUM(Commission), SUM(TotalPaidOut1)
FROM table
GROUP BY formname
答案 1 :(得分:1)
SELECT formname, SUM(totalenquires), SUM(commission), SUM(totalbusinesswrittenm), SUM(totalpaidout)
FROM table
GROUP BY formname
答案 2 :(得分:1)
SELECT formname,
SUM(TotalEnquires),
SUM(Commission),
SUM(TotalBusinessWritten),
SUM(TotalPaidOut1)
FROM YourTable
GROUP BY formname