日期:2014-05-16  浏览次数:20796 次

求一个简单的sql语句
表:
name,date,money,tex
求语句:
把所有列全部列出来,然后再最后加上一行money的总计

谁会??我写了半天除了总计之外还多了一行按date的每天小计...郁闷

------解决方案--------------------
SQL code
select name,date,money,tex from t
union all
select null,null,sum(money),null from t

------解决方案--------------------
探讨

select name,date,money,tex from vote
union
select null,null,sum(money),null from vote

------解决方案--------------------
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