SELECT DISTINCT x1.NUM_KANBAN_ID ID,
TO_CHAR(x1.DT_CREATE,'YYYY-MM-DD') CREATED,
x5.TXT_PLANT_CD CD,
TO_CHAR(x4.DT_FIRST_VIEWED,'YYYY-MM-DD') VIEWED,
TO_CHAR(x4.DT_DUE,'YYYY-MM-DD') DUE, x4.
TXT_SHUTTLE_NUMBER SHUTTLE,
(select count(*)
from WEDI_ASN_TO_DIMENSION t8
where t8.TXT_MATCH_CD='1'
AND t8.NUM_DIMENSION_ID=x2.NUM_DIMENSION_ID AND t8.NUM_MATCH_ID = x1.NUM_KANBAN_ID) ASN,
x1.TXT_JIT_CALL_NUM,
x2.NUM_VENDOR_ID VENDOR_ID
FROM WEDI_KANBAN x1, WEDI_DIMENSION x2, WEDI_USER_VENDORS x3, WEDI_KANBAN_TO_DIMENSION x4, WEDI_PLANT x5
WHERE x5.NUM_PLANT_ID = x2.NUM_PLANT_ID AND
x1.TXT_STATUS_CD = 'C' AND
x2.NUM_VENDOR_ID = x3.NUM_VENDOR_ID AND
x4.NUM_DIMENSION_ID = x2.NUM_DIMENSION_ID AND
x1.NUM_KANBAN_ID = x4.NUM_KANBAN_ID AND
x1.DT_CREATE < SYSDATE - 15 AND
x5.TXT_PLANT_CD LIKE '%' AND
x2.TXT_MATERIAL_NUM LIKE '%' AND
((x4.TXT_SHUTTLE_NUMBER IS NULL) OR (x4.TXT_SHUTTLE_NUMBER LIKE '%')) AND
x4.DT_DUE < SYSDATE - 10
ORDER BY VENDOR_ID
在上面的查询中,我应该显示 ASN 仅为 1 或 2 的 id。如果 ASN 有这样的 0,1,2 我不应该显示这些 ID。通常,如果 id 的 ASN 为 0,则不应显示。请建议