英语翻译select top 4 * from shop_books where anclassid = (select anclassid from shop_books where bookid = "&request("id")&") order by liulancount ,chengjiaocount,adddate desc这段代码大概的意思就是显示,查询字段的前4个数据,而

来源:学生作业帮助网 编辑:六六作业网 时间:2024/12/19 22:34:48
英语翻译selecttop4*fromshop_bookswhereanclassid=(selectanclassidfromshop_bookswherebookid="&request("id"

英语翻译select top 4 * from shop_books where anclassid = (select anclassid from shop_books where bookid = "&request("id")&") order by liulancount ,chengjiaocount,adddate desc这段代码大概的意思就是显示,查询字段的前4个数据,而
英语翻译
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 我该如何写呢,

英语翻译select top 4 * from shop_books where anclassid = (select anclassid from shop_books where bookid = "&request("id")&") order by liulancount ,chengjiaocount,adddate desc这段代码大概的意思就是显示,查询字段的前4个数据,而
这个不是ASP代码,是SQL语句
从shop_books数据库中查询bookid = "&request("id")&"的anclassid
然后从shop_books数据库中查询top 4(最上面的记录)
anclassid = 刚才查询的anclassid
然后按照 liulancount ,chengjiaocount,adddate desc 排序
楼上的是"select * from shop_books where anclassid = 31"
补充
select * from shop_books where anclassid = (select anclassid from shop_books where bookid = "&request("id")&") and anclassid = (select anclassid from shop_books where bookid = "&request("id+1")&") order by liulancount ,chengjiaocount,adddate desc
用AND连接

我想查询access数据库中字段anclassid为31的记录,anclassid的类型为数字,该怎么写呢?

从表shop_books前4个表项中查询
anclassid = 表shop_books中bookid为request("id")的ID值,然后把bookid的值按照liulancount ,chengjiaocount,adddate属性的综合降序排列
(request("id")这是提取上个页面或者本页面传送过来的ID值)
也就是说要查询的是 anclassid 的值<...

全部展开

从表shop_books前4个表项中查询
anclassid = 表shop_books中bookid为request("id")的ID值,然后把bookid的值按照liulancount ,chengjiaocount,adddate属性的综合降序排列
(request("id")这是提取上个页面或者本页面传送过来的ID值)
也就是说要查询的是 anclassid 的值
而 anclassid 的限制是bookid为上个页面或者本页面传送过来的ID值

收起