Upserting in MS-access

后端 未结 5 1576
天涯浪人
天涯浪人 2020-11-22 15:29

I need to write an SQL query for MS-Access 2000 so that a row is updated if it exists, but inserted if it does not. (I believe this is called an \"upsert\")

i.e.

5条回答
  •  时光取名叫无心
    2020-11-22 16:11

    You can simulate an upsert in an Access by using an UPDATE query with a LEFT JOIN.

    update b
    left join a on b.id=a.id
    set a.f1=b.f1
    , a.f2=b.f2
    , a.f3=b.f3
    

    see: https://www.experts-exchange.com/questions/28713136/Can-I-use-the-SQL-MERGE-statement-in-a-query-in-Access-2010.html

提交回复
热议问题