not exists
select * from c1 as t where not exists((
select count(*) from c1 where t.score> c1.score) > 2)
为什么出错?能这样使用吗?
[解决办法]
select * from c1 as t where --not exists
((select count(*) from c1 where t.score> c1.score)> 2)
not exists用法不正确
[解决办法]
--try
select * from c1 as t where (select count(*) from c1 where t.score> c1.score)> 2
[解决办法]
不要用not exists
例如:
if exists(select 1 from sysobjects where id=object_id( 'tablename '))
drop table tablename
也可以写成:
if (select count(1) from tablename )> 0
drop table tablename