如何多表联合查询数组值?
表名1:OrdersID p_ids time
1 1,2,3 2012-05-05
2 4 2012-05-05
3 5,6 2012-05-05
4 7,8 2012-05-05
表名2:Attribute
ID name
1 大众
2 奔驰
3 奥迪
4 丰田
5 大众
6 奥迪
7 标致
8 雪铁龙
要读取出两个表的数据
Attribute表里的ID 是和Orders表的 p_ids(字段)关联
'我之前的查询方法是用循环
set o_rs=Server.CreateObject("Adodb.Recordset")
o_sql="Select * from Orders order by id desc"
o_rs.open o_sql,conn,1,1
while not o_rs.eof
a_list = split(o_rs("p_ids"),",")
for i = 0 to UBound(a_list)
set A_rs=Server.CreateObject("Adodb.Recordset")
A_sql="Select * from Attribute where id="&a_list(i)
A_rs.open A_sql,conn,1,1
.....读数据....
A_rs.close
set A_rs=nothing
next
o_rs.movenext
wend
o_rs.close
set o_rs = nothing
现在想用多表查询 只用一句SQL语句
下面这句Orders表的p_ids字段里的数据为数组
sql="Select * from Orders,Attribute where (Attribute.id in (Orders.p_ids)) order by Attribute.id desc"
Set rs=Server.CreateObject("Adodb.Recordset")
rs.open sql,conn,1,1
查询后出错.
直接用一句SQL语句 请问如何查?