select * from A where id between 31 and 45 是这个意思吗?
编号有大小关系 select top 15 * from (select top 45 * from A order by ID )t order by ID desc
select * from (select *,row_number()over(order by ID) row from a)t where row between 31 and 45或 select top 15 * from A where ID not in(select top 30 ID from A) order by ID
select * from (select *,row_number()over(order by ID) row from a)t where row between 31 and 45或 select top 15 * from A where ID not in(select top 30 ID from A order by ID) order by ID--没排序时 select top 15 * from A where ID not in(select top 30 ID from A )--用表的默认排序时
select * from (select *,row_number()over(order by ID) row from a)t where row between 31 and 45 这句看不懂,能给解释一下吗?还有 select top 15 * from A where ID not in(select top 30 ID from A order by ID) order by ID 为什么要排序呢?
是这个意思吗?
select top 15 *
from (select top 45 * from A order by ID )t order by ID desc
from (select *,row_number()over(order by ID) row from a)t where row between 31 and 45或
select top 15 * from A where ID not in(select top 30 ID from A) order by ID
from (select *,row_number()over(order by ID) row from a)t where row between 31 and 45或
select top 15 * from A where ID not in(select top 30 ID from A order by ID) order by ID--没排序时
select top 15 * from A where ID not in(select top 30 ID from A )--用表的默认排序时
from (select *,row_number()over(order by ID) row from a)t where row between 31 and 45
这句看不懂,能给解释一下吗?还有
select top 15 * from A where ID not in(select top 30 ID from A order by ID) order by ID
为什么要排序呢?