非常基本,但不知道这种类型的查询被调用...我想要一个基本上会这样做的查询(伪SQL):
SELECT name
FROM Table
WHERE activity_status != 'active'
AND there are no rows with that same name where activity_status = 'active'
Run Code Online (Sandbox Code Playgroud)
(换句话说,只有当没有具有该名称的人员处于活动状态时,才会返回非活动的返回名称)
这将用于允许用户重新激活非活动项目的选项,但我想查询数据库以确保该项目尚未激活.