+ -
当前位置:首页 → 问答吧 → SQL查询问题 在线等

SQL查询问题 在线等

时间:2011-07-13

来源:互联网

num=5
piclistid="1,2,3,4,5" '这里的1,2,3,4,5为动态多个分类ID

function piclist(num,piclistid)

gettest="where ..............." '多个动态分类ID,怎么来截取分类ID个数,然后这里的筛选要怎么写

set rs=server.createobject("adodb.recordset")
rs.open"select * from picview "&gettest&" order by newid() desc",conn,1,1
If not rs.eof Then
Response.write(picurl)
end if
rs.close
set rs=nothing
end function

作者: BENCQS   发布时间: 2011-07-13

木有明白!

作者: chen_bruce   发布时间: 2011-07-13

gettest="where id in ("&piclistid&")"

作者: aspwebchh   发布时间: 2011-07-13

表,字段,查询要求

作者: gingerkang   发布时间: 2011-07-13

function piclist(num,piclistid)
piclistid=split(piclistid,",")
sql="select * from picview where"
for i=0 to ubound(piclistid)
sql=sql+"id="+""&piclistid(i)&""
if ubound(piclistid)>i+1 then
sql=sql+"or"
end if
next
sql=sql+"order by newid() desc"
set rs=server.createobject("adodb.recordset")
rs.open sql,conn,1,1
If not rs.eof Then
Response.write(picurl)
end if
rs.close
set rs=nothing
end function 
 
 

作者: ma1986   发布时间: 2011-07-13