日期:2014-05-17  浏览次数:20460 次

SQL查询前5条记录但是不包括第一条记录 怎么处理?
SQL查询前5条记录但是不包括第一条记录 怎么处理?
select top 5 newsid,newstitle,NewsContent,PicUrl,newstime from njsqnews where categoryid=199 and v2=1 and newsid not in (select top 1 newsid from njsqnews where categoryid=199 and v2=1) order by ordertime desc

我写的这个不起作用啊!

求大师指导

------解决方案--------------------
select top 5 newsid,newstitle,NewsContent,PicUrl,newstime from njsqnews where categoryid=199 and v2=1 and newsid not in (select top 1 newsid from njsqnews where categoryid=199 and v2=1 order by ordertime desc) order by ordertime desc
------解决方案--------------------

select top 5 * from [dbo].[ArcType] 
where id not in(select top 1 id from ArcType)


注意 外面的SQL和里面的SQL where 和order by 都要一样