如何生成此SQL Select子句?
我需要帮助把这个问题翻译成英语。 我有一个带有DEVICEID列的表设备,还有一个带有DEVICEID、CLONEID、PATH和VALUE列的表克隆 我想得到没有链接到克隆的设备,其中路径在硬编码集中,我们可以称为8个硬编码值,路径的值不在B中 能帮我想清楚吗 我的第一次尝试是如何生成此SQL Select子句?,sql,sql-server-2008,select,Sql,Sql Server 2008,Select,我需要帮助把这个问题翻译成英语。 我有一个带有DEVICEID列的表设备,还有一个带有DEVICEID、CLONEID、PATH和VALUE列的表克隆 我想得到没有链接到克隆的设备,其中路径在硬编码集中,我们可以称为8个硬编码值,路径的值不在B中 能帮我想清楚吗 我的第一次尝试是 SELECT d FROM device d, clone c WHERE d.deviceid = c.deviceid AND (c.path = 'a[1]' OR c.pa
SELECT d
FROM device d, clone c
WHERE d.deviceid = c.deviceid
AND (c.path = 'a[1]' OR c.path = 'a[2]' ... )
AND x.value not in B
但每个路径的OR值都不正确 假设A和B是值列表
select d from device d where not exists (select c.device_id from
clone c where d.deviceid = c.deviceid and c.path in (A) and
c.value not in (B)
)
Select d
from device d
where not exists (select * from clone c where c.deviceid=d.deviceid
and (c.path = 'a[1]' OR c.path = 'a[2]')
and c.value not in ('hardcoded list')
)