簡體   English   中英

什么SQL語句將確定集合中的哪些值不在指定的列中?

[英]What SQL statement will determine which values in a set are not in a specified column?

什么SQL語句將確定一組值中的哪些值不在指定的列中? 例如:

{"String1","String2","String3"}

什么SQL語句將確定哪些字符串值Column1 Table1 Column1中?

沒有Linq因為我正在使用VS2005。

嘗試這個:

 select *
 from 
 (
      select 'String1' as s 
      union select 'String2' 
      union select 'String3'
 ) as x
 where x.s not in (select column1 from table1)

嘗試這個:

WHERE Table1.Column1 NOT IN ("String1", "String2", "String3")

IN運算符

例如。

SELECT COLUMN1 FROM TABLE1 WHERE COLUMN1 IN ('String1','String2','String3')

這可能有所幫助,

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)

這個怎么樣:

SELECT * FROM Table1
WHERE Table1.Column1 NOT IN 
(
'String1',
'String2',
'String3'
)

暫無
暫無

聲明:本站的技術帖子網頁,遵循CC BY-SA 4.0協議,如果您需要轉載,請注明本站網址或者原文地址。任何問題請咨詢:yoyou2525@163.com.

 
粵ICP備18138465號  © 2020-2024 STACKOOM.COM