delete #fff from #fff a where a.摘要='本年累计发生额' and a.月='当月的月份' and exists (select 摘要 from #fff b where b.摘要='本月发生额' and a.月=b.月 and a.年=b.年 and b.借方金额=0 and b.贷方金额=0 )
delete fff from fff left join (select 年,月 from fff where 摘要='本月发生额' and (借方金额<>0 or 贷方金额<>0)) a on fff.摘要='本年累计发生额' and fff.月=a.月 and fff.年=a.年delete from fff where 摘要='本月发生额' and 借方金额=0 and 贷方金额=0
delete #fff from #fff a where #fff.摘要='本月累计发生额' and a.摘要='本年累计发生额' and #fff.月=a.月 and #fff.年=#fff.年
这是我根据你的提示更改的语句: jameszht(湖泊) 。请帮我再看一看吧 delete #fff from #fff inner join (select 年,月 from #fff where 摘要='本月发生额' and (借方金额<>0 and 贷方金额<>0)) a on #fff.月=a.月 and #fff.年=a.年 where #fff.摘要='本年累计发生额'
a.摘要='本年累计发生额' and #fff.月=a.月 and #fff.年=#fff.年
delete #fff from #fff inner join (select 年,月 from #fff where 摘要='本月发生额' and (借方金额<>0 and 贷方金额<>0)) a on #fff.月=a.月 and #fff.年=a.年 where #fff.摘要='本年累计发生额'
月 摘要 客户 借方 贷方
3 上月结转 48,422.25 23,491.06
3 本月发生额
3 本年累计发生额 48,422.25 23,491.06
3 上月结转 195,080.63
3 收上海宝升国货运费 US 6,753.71
3 收上海宝升国货运费 US 3,342.50
3 收上海宝升国货运费 US 6,753.71
3 收上海宝升国货运费 US 6,753.71
3 本月发生额 202,032.91
3 本年累计发生额 202,032.91
月 摘要 客户 借方 贷方
3 上月结转 a 48,422.25 23,491.06
3 本月发生额 a
3 本年累计发生额 a 48,422.25 23,491.06
3 上月结转 a 195,080.63
3 收上海宝升国货运费 6,753.71
3 收上海宝升国货运费 US 3,342.50
3 收上海宝升国货运费 US 6,753.71
3 收上海宝升国货运费 US 6,753.71
3 本月发生额 202,032.91
3 本年累计发生额 202,032.91
——不是sql语句的问题。