如何选择where = list

时间:2011-03-19 07:46:43

标签: sql sql-server sql-server-2005

select NameCompany from [ParticipateFairList] 
where IdFair=(select Id from [TmpFair] where Parent_FK=88)

这是正确的吗?

如何

For Select * From [Table] where ID=`List` or `SubQuery`

2 个答案:

答案 0 :(得分:1)

select NameCompany from [ParticipateFairList] 
where IdFair in (select Id from [TmpFair] where Parent_FK=88)

其中IdFair在(...)而不是IdFair =(...)

答案 1 :(得分:0)

对于MySQLSQL Server,您需要expr IN (list | subquery)