exists 的应用

[code]
SELECT cq.ayxsbh, cq.process_ins_id, nsr.nsrsbh, nsr.nsrmc, jg.swjg_mc
FROM t03_cqzb cq, t03_ayxsqc ay, dm_swjg jg, dj_nsrxx nsr
WHERE cq.process_ins_id = 2991
AND SYSDATE > cq.jzrq
AND NOT EXISTS (
SELECT 1
FROM t03_cqzb_wc wc
WHERE wc.process_ins_id = cq.process_ins_id
AND wc.lcjsbz = 'Y')
AND cq.ayxsbh = ay.ayxsbh
AND ay.nsrsbh = nsr.nsrsbh
AND ay.lrdw_bm = jg.swjg_dm
[/code]

你可能感兴趣的:(sql)