没看懂你的需求,这样么 select name,date,money,tex from 表 union all select 1,1,sum(money),1 from 表
select name,date,money,tex from t union all select null,null,sum(money),null from t
select name,date,money,tex,sum(money) over(partition by name) from table 其中name 代表唯一主键
select t.name,t.date,t.money,t.tex,x.sum_money from t left join (select date,sum(money) from t group by date) x on x.date=t.date
select name,date,tex,sum(money) over(partition by name order by date) as money from tb
select name,date,money,tex from vote union select null,null,sum(money),null from vote
这样就能行啊 要不这样也行With t As( Select '11' Name,'20100101' Date1,10 money From dual Union All Select '12','20100102' ,10 From dual Union All Select '13' ,'20100103' ,10 From dual Union All Select '14' ,'20100103' ,10 From dual Union All Select '15' ,'20100104' ,10 From dual Union All Select '15' ,'20100105' ,10 From dual ) Select Name,Date1,Sum(money) c From t Group By Rollup(Name,Date1) Having Grouping(Name) = Grouping(date1)
selct name,date,money,tex ,money_total from (select name,date,money,tex from table1) a, (select sum(money) as money_total from table1) b
select name,date,money,tex from tablename union select null,null,sum(money),null from tablename
select name,date,money,tex from tablename union select null,null,sum(money),null from tablename
这里的最后一行,只是返回结果集里所有记录的money合计?
select name,date,money,tex from 表
union all
select 1,1,sum(money),1 from 表
union all
select null,null,sum(money),null from t
其中name 代表唯一主键
left join
(select date,sum(money) from t group by date) x
on
x.date=t.date
from tb
union
select null,null,sum(money),null from vote
要不这样也行With t As(
Select '11' Name,'20100101' Date1,10 money From dual
Union All
Select '12','20100102' ,10 From dual
Union All
Select '13' ,'20100103' ,10 From dual
Union All
Select '14' ,'20100103' ,10 From dual
Union All
Select '15' ,'20100104' ,10 From dual
Union All
Select '15' ,'20100105' ,10 From dual
)
Select Name,Date1,Sum(money) c
From t
Group By Rollup(Name,Date1)
Having Grouping(Name) = Grouping(date1)
name,date,money,tex ,money_total from
(select name,date,money,tex from table1) a,
(select sum(money) as money_total from table1) b
union
select null,null,sum(money),null from tablename
union
select null,null,sum(money),null from tablename