当前位置: 代码迷 >> Sql Server >> exists附近有错?解决办法
  详细解决方案

exists附近有错?解决办法

热度:41   发布时间:2016-04-27 20:42:07.0
exists附近有错?
select   top   16   *   from   picUploadT   where   picType= 'baobaoXiu '   and   userid   in   (1,2,3)   order   by   picId   desc   这样是不要运行的

select   top   16   *   from   picUploadT   where   picType= 'baobaoXiu '   and   userid   exists   (1,2,3)   order   by   picId   desc   就提示错误。
请问:错在哪里?谢谢

------解决方案--------------------
declare @t table(id int)
insert into @t select 1 union select 2 union select 3 union select 4

select *
from @t
where id =any (select 1 union select 2)
/*

id
-----------
1
2

*/

嘿嘿
------解决方案--------------------
select top 16 * from picUploadT where picType= 'baobaoXiu ' and userid exists (1,2,3) order by picId desc


userid exists (1,2,3) 这里不对
exists 和 in不是一个概念
  相关解决方案