select CODE_MTH,"NVL"(t3.CNT , 0) cnt from (SELECT * FROM DMB_MTH WHERE CODE_YEAR=to_char(sysdate,'yyyy')) T1
LEFT JOIN(
select to_char(OPDT,'yyyyMM') m,NVL("COUNT"(cardno),0) cnt from
( SELECT DISTINCT c.cardno,a.DPTNAME,c.OPDT from BUFF_YKT_BASE_DEPT a
LEFT JOIN buff_ykt_BASE_TERM b on a.DPTCODE = b.DPTCODE
LEFT JOIN buff_ykt_rec_main_consume c on c.TERMID = b.TERMID WHERE to_char(c.OPDT,'yy')=to_char(sysdate,'yy') AND a.DPTCODE = '032'
UNION ALL
SELECT DISTINCT f.cardno,d.DPTNAME,f.opdt from BUFF_YKT_BASE_DEPT d
LEFT JOIN buff_ykt_BASE_TERM e on d.DPTCODE = e.DPTCODE
LEFT JOIN BUFF_YKT_REC_SUBSIDY_CONSUME f on f.TERMID = e.TERMID WHERE to_char(f.OPDT,'yy')=to_char(sysdate,'yy') AND d.DPTCODE = '032'
) t2
GROUP BY to_char(t2.opdt,'yyyyMM') ORDER BY to_char(t2.opdt,'yyyyMM'
数据类型不一致: 应为 NUMBER, 但却获得 -
最新推荐文章于 2024-07-01 10:49:03 发布
![](https://img-home.csdnimg.cn/images/20240711042549.png)