select top 5 * from sp_info where (id not in (select top 5 id from sp_info where ischk=1 and (sptype=4 or sptype=5) order by id desc)) and ischk=1 and (sptype=4 or sptype=5) order by id desc
select top 5 * from sp_info where (id not in (select top 5 id --替换此处 from sp_info where ischk=1 and (sptype=4 or sptype=5) order by id desc)) and ischk=1 and (sptype=4 or sptype=5) order by id desc
not in 或in后面要指定单个字段不能多个字段.
select top 5 * from sp_info where id not in ( select top 5 id from sp_info where ischk = 1 and (sptype=4 or sptype=5) order by id desc ) and ischk = 1 and (sptype=4 or sptype=5) order by id desc
select top 5 * from sp_info where id not in (select top 5 id from sp_info where ischk=1 and (sptype=4 or sptype=5) order by id desc) and ischk=1 and (sptype=4 or sptype=5) order by id desc
select top 5 * from sp_info where (id not in (select top 5 id from sp_info where ischk=1 and (sptype=4 or sptype=5) order by id desc)) and ischk=1 and (sptype=4 or sptype=5) order by id desc
select
top 5 *
from
sp_info
where
(id not in (select
top 5 id --替换此处
from
sp_info
where
ischk=1 and (sptype=4 or sptype=5) order by id desc))
and
ischk=1
and
(sptype=4 or sptype=5)
order by
id desc
id not in
(
select top 5 id from sp_info where ischk = 1 and (sptype=4 or sptype=5) order by id desc
)
and ischk = 1 and (sptype=4 or sptype=5)
order by id desc
id not in (select top 5 id from sp_info where ischk=1 and (sptype=4 or sptype=5) order by id desc)
and ischk=1
and (sptype=4 or sptype=5) order by id desc
from sp_info
where (id not in (select top 5 id
from sp_info
where ischk=1 and (sptype=4 or sptype=5)
order by id desc))
and ischk=1 and (sptype=4 or sptype=5)
order by id desc