「Items」と「Itemldgr」の 2 つのテーブルがあります。からitems.saleprice
最新のものを使用して更新したい。itemldgr.purchaseprice
itemldgr
これは一種の単純なアイデアです。
update items set items.saleprice = (itemldgr.purchaseprice * 1.30) from itemldgr,
items
where items.itemid = itemldgr.itemid
and itemldgr.docdate = (
select itemldgr.itemid,MAX(docdate)
from itemldgr
where itemldgr.docid = 'RR'
and itemldgr.netcost <> '0'
and itemldgr.qtyin <> '0'
group by itemldgr.itemid
order by itemid)`