how to execute ms access query

41 Views Asked by At

i have three tables named 1:site_stock, 2:item_add, 3:stock_add. now i want to update site_stock its value should be sum of item_add initial balance and stock_add quantity of item i have try this query but it gives me error "operation must be used updateable query"

UPDATE site_stock
SET quantity = ((select sum(sa.quantity) from stock_add as sa where sa.item_code='J-110') +
                (select sum(ia.quantity) from item_add as ia where ia.item_code='J-110'))
WHERE item_code='J-110' and site_id=1;
1

There are 1 best solutions below

0
On
UPDATE ((site_stock inner join item_add on site_stock.item_code=item_add.item_code) left join stock_add on site_stock.item_code=stock_add.item_code )  SET site_stock.quantity =(item_add.quantity + (iif(stock_add.quantity is null,0,stock_add.quantity))) WHERE  item_add.item_code=site_stock.item_code and site_stock.site_id=1;