SQL语句查询问题,,请各位大虾帮帮忙
发布网友
发布时间:2024-10-04 19:29
我来回答
共1个回答
热心网友
时间:2024-10-04 23:55
不知道想要什么结果,两种查询试试吧。
select cw_tallysum_accountid,cw_tallysum_date,
[sum]=(select sum(cw_tallysum_in) from table1 where cw_tallysum_accountid=t1.cw_tallysum_accountid and cw_tallysum_date<=t1.cw_tallysum_date)
from table1 t1 group by cw_tallysum_accountid,cw_tallysum_date
select cw_tallysum_accountid,
[sum]=(select sum(cw_tallysum_in) from table1 where cw_tallysum_accountid=t1.cw_tallysum_accountid and cw_tallysum_date<='2011-11-11')
from table1 t1 where group by cw_tallysum_accountid