How to update ms access database table using update and sum() function?

后端 未结 3 1793
春和景丽
春和景丽 2020-12-21 22:22

I have Two tables in my access database

  • table1(ID,productname,qunatity,remainder)
  • table2(ID,productname,sales)

these tables are rela

3条回答
  •  [愿得一人]
    2020-12-21 23:03

    Because update queries in MS Access require updateable status, you cannot use a direct inner join on an aggregate query. Consider using the MS Access DSum() function:

    UPDATE table1
    SET table1.remainder = table1.quantity - 
        DSum("Sales", "table2", "ProductName='" & table1.ProductName & "'")
    

提交回复
热议问题