Hi...

I have a
table: bom
fields:
Comp = P28
ReqQty = 31968

and I have table
table: dipping
fields needed to get data
LOT_CODE
OUTPUT_QTY
DATE_ENTRY

now I only want to get LOT_CODE and OUTPUT_QTY where can suffix the ReqQty ORDER BY DATE_ENTRY

I tried this query:

Code:
SELECT SUBSTR(LOT_CODE, 9,4) AS Comp, LOT_CODE, OUTPUT_QTY, DATE_ENTRY FROM dipping WHERE SUBSTR(LOT_CODE, 9,4) = 'P28'   ORDER BY DATE_ENTRY ASC;
I attach the result of this query.

I want only query or get is the LOT_CODE where the OUTPUT can suffix the ReqQty.


Simple Example:

ReqQty = 100
Comp = P28

LOT_CODE--OUTPUT_QTY---DATE_ENTRY
00001P28--- 50------------2012-05-15
00002P28----25------------2012-05-16
00003P28----50------------2012-05-17
00004P28----25-----------2012-05-18
in query I need to get only the
00001P28--- 50------------2012-05-15
00002P28----25------------2012-05-16
00003P28----50------------2012-05-17

because it suffix my ReqQty as you can see in this LOT_CODE
00003P28----50------------2012-05-17 i only need is 25 to suffix my Req
Qty so I need to display only:

00001P28--- 50------------2012-05-15
00002P28----25------------2012-05-16
00003P28----25------------2012-05-17

Feel free to ask me if theirs any question for better understanding of my problem
Thank you