我在下面显示我的表结构。我希望记录像第二个结构。请帮我用oracle或SQL来搞定。
FLd_Date Fld_Via Fld_Amt
11/1/2013 cash 100.26
11/2/2013 online 123.00
11/3/2013 cash 32.00
11/4/2013 cash 234.00
11/5/2013 cash 125.00
11/6/2013 online 125.00
11/7/2013 cash 200.00
11/8/2013 online 111.00
11/9/2013 online 143.00
11/10/2013 cash 155.00
11/11/2013 online 12.00
11/12/2013 online 142.00
我想要像这样的输出
mode count total
cash 6 846.26
online 6 656
答案 0 :(得分:2)
select fld_via as mode,
count(*) as count,
sum(fld_amt) as total
from your_table
group by fld_via
答案 1 :(得分:1)
请尝试:
select
Fld_Via as "mode",
count(*) as "count",
sum(Fld_Amt) as "total"
from
YourTable
Group by Fld_Via