日期:2014-05-18 浏览次数:20497 次
select *,10 from wubw a where (select count(*) from (select * from wubw where wNum=3) s where ID <=a.ID)=10
------解决方案--------------------
select *,10 from wubw a where (select count(1) from (select 1 from wubw where wNum=3) s where ID <=a.ID)=10
------解决方案--------------------
是啊,写的比较烦琐!
------解决方案--------------------
--试试
Select * ,10 as fid from wubw as a
where (Select count(*) from wubw where wNum=3 and ID<=a.ID)=10
------解决方案--------------------
上面那个错了
select *,10 from wubw a where (select count(1) from (select ID from wubw where wNum=3) s where ID <=a.ID)=10
------解决方案--------------------
select *, 10 as fid from wubw a where (select count(*) from (select * from wubw where wNum=3) s where ID <=a.ID)=10
------解决方案--------------------
查询结果显示:
ID从小到大排序
显示第10行
wNum=3
-------------
select * from wubw a where wNum=3 and (select count(1) from wubw where wNum=3 and ID<=a.ID)=10
------解决方案--------------------
--或者
Select top 1 *,10 as fid from ( Select top 10 * from wubw where wNum=3 Order by ID ) t Order by ID desc