Use SELECT inside an UPDATE query

后端 未结 6 2110
刺人心
刺人心 2020-11-30 07:51

How can I UPDATE a field of a table with the result of a SELECT query in Microsoft Access 2007.

Here\'s the Select Query:

S         


        
6条回答
  •  一生所求
    2020-11-30 08:45

    I did want to add one more answer that utilizes a VBA function, but it does get the job done in one SQL statement. Though, it can be slow.

    UPDATE FUNCTIONS
    SET FUNCTIONS.Func_TaxRef = DLookUp("MinOfTax_Code", "SELECT
    FUNCTIONS.Func_ID,Min(TAX.Tax_Code) AS MinOfTax_Code
    FROM TAX, FUNCTIONS
    WHERE (((FUNCTIONS.Func_Pure)<=[Tax_ToPrice]) AND ((FUNCTIONS.Func_Year)=[Tax_Year]))
    GROUP BY FUNCTIONS.Func_ID;", "FUNCTIONS.Func_ID=" & Func_ID)
    

提交回复
热议问题