如何在SQL查询where子句中指定多个值?

时间:2012-02-21 12:24:31

标签: sql where-clause

我目前的查询是:

Select Distinct
  SomeDay.SomeDayID, SomeDay.FolderName, SomeDay.FolderColor
from
  SomeDay, SomeDayEvent
where
  SomeDay.SomeDayID != 4,3,2,1;

3 个答案:

答案 0 :(得分:8)

我想你想要:

Select Distinct
  SomeDay.SomeDayID, SomeDay.FolderName, SomeDay.FolderColor
from
  SomeDay, SomeDayEvent
where
  SomeDay.SomeDayID not in (4,3,2,1)

答案 1 :(得分:0)

这是您的问题所在。

Select Distinct
SomeDay.SomeDayID, SomeDay.FolderName, SomeDay.FolderColor
from 
SomeDay, SomeDayEvent 
where
SomeDay.SomeDayID>4;

答案 2 :(得分:-1)

这应该是

Select Distinct
   SomeDay.SomeDayID, SomeDay.FolderName, SomeDay.FolderColor
from  
   SomeDay, SomeDayEvent
where
   SomeDay.SomeDayID != 4
and
   SomeDay.SomeDayID != 3
and
   SomeDay.SomeDayID != 2
and
   SomeDay.SomeDayID != 1;