ASP程序中,SQL语句选取某个区间的记录怎么编写

2024-12-29 12:50:22
推荐回答(3个)
回答1:

1.连续的几条记录
用 between and
2.选择性的相隔的几条记录
用 nsort_id in(5,8,10)
sql="select top 1 * from nsort where nsort_id in(5,8,10) order by nsort_id desc"

回答2:

1:取第5-第8条:select top 3 * from nsort where nsort_id not in(select top 4 nsort_id from nsort order by nsort_id desc) order by nsort_id desc
2:不知道,期待答案。

回答3:

select top 5 * from product where productid<100 order by productid desc
union