I have an application for receiving and shipping. I am handling these 2 processes in the transaction table. While receiving the item manually giving BOE number, so all receiving record having BOE number. But while shipping out an item am not updating this BOE column. Actually I need to know this Item came from which BOE (I want to use FIFO) criteria. Now my transaction table has a lot of data. But I want to know each BOE how many item came and how many item out.
I have made query like this
select
F_lot_number, sum(INq) 'IN', sum(OUTs) 'OUT', sum(BOE) 'BOEcount'
from
(select
F_lot_number,
case
when F_Stock_Type = 'IN' then sum(F_qty)
end as 'INq',
case
when F_Stock_Type = 'out' and F_IsBook = '2' then sum(F_qty)
end as 'OUTs',
case
when F_Stock_Type = 'IN'
then count(distinct F_BillOf_entryNumber)
end as 'BOE'
from
T_Tra_Transaction
group by
F_lot_number, F_Stock_Type, F_IsBook) d
group by
F_lot_number
Output looks like this:
if example
select
F_QTY, F_lot_number, F_BillOf_entryNumber
from
T_Tra_Transaction
where
F_lot_number = '150723A151'
and F_Stock_Type = 'IN'
select
F_QTY, F_lot_number, F_BillOf_entryNumber
from
T_Tra_Transaction
where
F_lot_number = '150723A151'
and F_Stock_Type = 'out'
Output looks like this:
I need to update all out status with corresponding BOE number. How can I do that? i need to updated all of my existing recordes according to that.if any help am very thank full
In my table i have transdatetime
field also there.
i have checked other lot number..
select
F_QTY, F_lot_number, F_BillOf_entryNumber
from
T_Tra_Transaction
where
F_lot_number = '150919C131'
and F_Stock_Type = 'IN'
select
F_QTY, F_lot_number, F_BillOf_entryNumber
from
T_Tra_Transaction
where
F_lot_number = '150919C131'
and F_Stock_Type = 'out'