I have table mkitem for items and mknewitem where it will store all of the updated value. Each updated row for items will update in mkitem and mknewitem. While mkolditems will store the value before the updated. I hope this is clears.
I am trying to do and sql code to get the item_code, item_name, item_barcode, old_price and new_price. I have tried a few code but I dont think, I get the output like how I imagined. Please help me.
this is what I tried using nested.
select distinct g.trn_no, g.item_code, g.item_barcode,g.item_name, s.sprice old, g.sprice new
from mkmknewitem g, mkolditems s
where g.trn_no=s.trn_no
and g.item_code = s.item_code
and trunc(to_date(g.crt_date,'dd//mm/yyyy')) between trunc(to_date('01/01/2020','dd//mm/yyyy')) AND trunc(to_date('23/01/2020','dd//mm/yyyy'))
and g.date_b3 is not null
and s.store_no in ('RW','RQ','RD')
order by g.item_code, g.trn_no;