Use SELECT inside an UPDATE query

后端 未结 6 2115
刺人心
刺人心 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:23

    I know this topic is old, but I thought I could add something to it.

    I could not make an Update with Select query work using SQL in MS Access 2010. I used Tomalak's suggestion to make this work. I had a screenshot, but am apparently too much of a newb on this site to be able to post it.

    I was able to do this using the Query Design tool, but even as I was looking at a confirmed successful update query, Access was not able to show me the SQL that made it happen. So I could not make this work with SQL code alone.

    I created and saved my select query as a separate query. In the Query Design tool, I added the table I'm trying to update the the select query I had saved (I put the unique key in the select query so it had a link between them). Just as Tomalak had suggested, I changed the Query Type to Update. I then just had to choose the fields (and designate the table) I was trying to update. In the "Update To" fields, I typed in the name of the fields from the select query I had brought in.

    This format was successful and updated the original table.

提交回复
热议问题