Hi Guys,
I have an issue to ask. I need to extract the final issued parts from a table. Table stores the issue and unissue parts.
e.g lets say 4 items have been issued and 3 items have been un-issued from a table. so in last 1 items should be resulted. while I am executing the following code its not working correctly.
Table data:
REPAIRED_ITEM_ID ISSUED_REMOVED_ PART_ID Oper_ID QTY
122013187 1323938 308 1
122013187 1323938 308 1
122013187 1323938 309 1
122013187 1323940 308 1
122013187 1323940 308 1
122013187 1323940 309 1
122013187 1323940 309 1
SELECT * FROM WC1.ISSUED_REMOVED_ITEM IRI
WHERE
IRI.ORDER_ITEM_OPER_ID = 308
AND IRI.SES_CUSTOMER_ID =1
AND IRI.REPAIRED_ITEM_ID = 122013187
AND 0 = (SELECT COUNT(1)
FROM WC1.ISSUED_REMOVED_ITEM U
WHERE U.REPAIRED_ITEM_ID = IRI.REPAIRED_ITEM_ID
AND U.ORDER_ITEM_OPER_ID = 309
AND U.SES_CUSTOMER_ID= 1
)
But the above query is not showing any result, while it should show 1 record of 1323938 , Can anyone please explain me how to get this right result?
Note: Repair Item id is unique of MAIN UNIT. which can contains multiple issue and un-issue of dependent units.
Many Thanks,
M.C.
Edited by: BluShadow on 06-Sep-2012 13:19
added {noformat}
{noformat} tags to help readability. Please read {message:id=9360002} and learn to post questions with format in future.