请高手帮忙写一小段sql代码

来源:百度知道 编辑:UC知道 时间:2024/05/15 02:12:24
select top 4 * from shop_books where anclassid = (select anclassid from shop_books where bookid = "&request("id")&") order by liulancount ,chengjiaocount,adddate desc
问题补充:这段代码大概的意思就是显示,查询字段的前4个数据,而我现在想让他显示,这个数据和这个数据紧挨的三个数据.就像
1
2
3
4
5
如果request("id")=2
我想让这段代码显示 2 3 4 5 我该如何写呢,高手帮忙吧.
这次OK了
下次注意一定要看清楚再写.-_-!

不好意思,没注意这点,用 in 就行了,在试试

select top 4 * from shop_books where anclassid in (select anclassid from shop_books where bookid >= "&request("id")&") order by liulancount ,chengjiaocount,adddate desc

dim mark
mark=0
do while 里加上

if mark=0 then
mark=mark+1
rs.movenext
loop

写上你要显示的东东
rs.movenext
loop

这样一定行,我用过!