烟台八角海产品:大家帮我看一个select的语句

来源:百度文库 编辑:中科新闻网 时间:2024/04/17 07:02:22
set rs2=server.CreateObject("adodb.recordset")
rs2.open "select id,name,score,price1,price2,vipprice,discount from product where id in ("&id&") order by id ",conn,1,1

set rs=server.CreateObject("adodb.recordset")
rs.open "select product.id,product.name,product.vipprice,product.price1,product.price2,product.score,orders.sex,orders.realname,orders.recepit,orders.goods,orders.postcode,orders.comments,orders.paymethord,orders.deliverymethord,orders.paid,orders.productnum from product inner join orders on product.id=orders.id where orders.username='"&request.Cookies("timesshop")("username")&"' and state=2 and goods='"&goods&"' ",conn,1,1

这两个有点麻烦,第一段中where id in ("&id&") order by id ",conn,1,1,那个("&id&")是怎么获得的呢,我找了好久找不到,请大家看一下怎么获得的.
能不能解释一下这两段该怎么理解呢,多谢了!

第一个“ID”是一个变量,你看看之前有没有那里设置这个 集合变量。有时候表单中的可重复选择框就可以得到这样的 变量集合。
第二段:product.name前面的是表名,后面的是字段名,orders.postcode也是一样的,因为这里用到了两个表,所以要注明是哪个表的字段。
from product inner join orders on product.id=orders.id
product inner join orders 两个表建立联系
on product.id=orders.id 建立联系的条件
where orders.username='"&request.Cookies("timesshop")("username")&"' and state=2 and goods='"&goods&"' 这些都是筛选条件
request.Cookies("timesshop")("username") 获得COOKIES记录的信息。