哪个SQL语句将确定一组值中的哪些值不在指定列中?例如:
{"String1","String2","String3"}
哪个SQL语句将确定哪些字符串值不在Column1
的{{1}}中?
No Linq因为我正在使用VS2005。
答案 0 :(得分:3)
试试这个:
select *
from
(
select 'String1' as s
union select 'String2'
union select 'String3'
) as x
where x.s not in (select column1 from table1)
答案 1 :(得分:0)
试试这个:
WHERE Table1.Column1 NOT IN ("String1", "String2", "String3")
答案 2 :(得分:0)
IN
运算符
例如
SELECT COLUMN1 FROM TABLE1 WHERE COLUMN1 IN ('String1','String2','String3')
答案 3 :(得分:0)
这可能会有所帮助,
select * from
(
select 'String1' as s
union select 'String2'
union select 'String3'
) as a
where not exists (select 'x' from Table1 where Column1 = a.s)
答案 4 :(得分:0)
这个怎么样:
SELECT * FROM Table1
WHERE Table1.Column1 NOT IN
(
'String1',
'String2',
'String3'
)