1
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我不應該顯示。 PLS建議Sql篩選選擇
eeerrrrrrrrrrrrr .....哪個字段保存ASN? –
hihi,是'select'子句中的子查詢:))) –