多谢 select a.JSJDM from DJ_NSRXX a inner join DJ_BG b on a.NSRBH = b.NSRBH and a.NSRZT_DM='Y' and a.SBDJBZ='N' and b.BGRQ between(trunc(add_months(last_day(SYSDATE)+1,-2))) and (trunc(last_day(add_months(SYSDATE,-1)))) inner join DJ_NSRXX_KZ c on b.NSRBH = c.NSRBH and c.KYRQ-b.BGRQ>30
看消息,看消息! SQL code: select a.JSJDM from DJ_NSRXX a, DJ_BG b, DJ_NSRXX_KZ c where a.NSRZT_DM in ('Y','N') and a.SBDJBZ not in ('Y','N') and to_number(to_char(b.BGRQ ,'MM'))=to_number(to_char(sysdate,'MM'))-1 and b.BGRQ>c.DJ_NSRXX_KZ+30 and a.NSRBH=b.NSRBH and a.NSRBH=c.NSRBH