-1

「Items」と「Itemldgr」の 2 つのテーブルがあります。からitems.saleprice最新のものを使用して更新したい。itemldgr.purchasepriceitemldgr

これは一種の単純なアイデアです。

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)`
4

2 に答える 2