小编use*_*rod的帖子

MS Access 插入不存在的地方

我有下表:

+-----------+--------+
| FirstName | Active |
+-----------+--------+
| Rob       | TRUE   |
| Jason     | TRUE   |
| Mike      | FALSE  |
+-----------+--------+
Run Code Online (Sandbox Code Playgroud)

仅当 John 的条目不存在时,where Active=True.我才想插入“John”(使用 Active=True)我尝试以下操作:

insert into testTable (FirstName, Active) values ('John',True) where not exists (select 1 from testTable where FirstName='John' and Active=True)
Run Code Online (Sandbox Code Playgroud)

但我得到“查询输入必须至少包含一个表或查询”。

任何人都可以帮助我实现目标吗?

ms-access conditional insert exists where

4
推荐指数
1
解决办法
4522
查看次数

标签 统计

conditional ×1

exists ×1

insert ×1

ms-access ×1

where ×1