select null id, cast(a.acc_set as varchar(50)) key1, cast(a.years as varchar(50)) key2,cast(a.months as varchar(50)) key3, a.acc_name key4, '' key5, b.distNo bh, b.distName mc, b.distNo, b.ztid, CAST(12 as numeric) lvalue,cast(isnull(zzny,0)-isnull(fsny,0) as numeric) as rvalue,cast(isnull(zzny,0)-isnull(fsny,0)-12 as numeric) as zvalue, '' writer, '' writeDate from ( select acc_set,acc_name,years,months,(years*12+months) fsny from hd_bjAccountnew..balance where exists( select * from (select acc_set,acc_name,MAX(years*12+months) fsny from hd_bjAccountnew..balance where acc_code like '154%' and (ISNULL(debit_month,0)<>0 or ISNULL(credit_month,0)<>0) and exists(select acc_set,acc_code from hd_bjAccountnew..acc_code where lastflag=1 and acc_code like '154%' and exists(select years,acc_set from hd_bjAccountnew..acc_set where acc_set.years=acc_code.years and acc_set.acc_set=acc_code.acc_set) and acc_code.acc_set=balance.acc_set and acc_code.acc_code=balance.acc_code)and (ISNULL(debit_month,0)<>0 or ISNULL(credit_month,0)<>0) group by acc_set,acc_name )a where a.acc_set=balance.acc_set and a.acc_name=balance.acc_name and a.fsny=(balance.years*12+balance.months) ) )a join (select acc_set,years,months,years*12+months zzny from hd_bjAccountnew..acc_set)c on a.acc_set=c.acc_set join zcjy_hd..zt b on a.acc_set=b.BS_ztNo where zzny-fsny>12
2条回答 默认 最新
悬赏问题
- ¥15 UE5#if WITH_EDITOR导致打包的功能不可用
- ¥15 关于#stm32#的问题:CANOpen的PDO同步传输问题
- ¥20 yolov5自定义Prune报错,如何解决?
- ¥15 电磁场的matlab仿真
- ¥15 mars2d在vue3中的引入问题
- ¥50 h5唤醒支付宝并跳转至向小荷包转账界面
- ¥15 算法题:数的划分,用记忆化DFS做WA求调
- ¥15 chatglm-6b应用到django项目中,模型加载失败
- ¥15 CreateBitmapFromWicBitmap内存释放问题。
- ¥30 win c++ socket