#12002/12/17 14:51:55
这个问题不只见人第一次问到了,兄弟不才,做了个例子
数据表column结构如下,看看,也许对大家有点帮助
id column1 column2 column3
1 1 1 1
2 1 1 2
3 1 1 3
4 1 2 1
5 1 2 2
6 2 1 1
7 2 1 1
8 3 1 2
<%
set conn = server.CreateObject("adodb.connection")
connstr = 数据库连接字符串
conn.Open connstr
set rs = server.CreateObject("adodb.recordset")
sql = "select distinct column1 from [column]"
rs.Open sql,conn,1,1
first_text = ""
first_default_select = rs(0)
while not rs.EOF
first_text = first_text & ""
rs.MoveNext
wend
rs.Close
sql = "select column2 from [column] where column1 =" & cint(first_default_select)
rs.Open sql,conn,1,1
second_default_select = rs(0)
while not rs.EOF
second_text = second_text & ""
rs.MoveNext
wend
rs.close
sql = "select column3 from [column] where column2 =" & cint(second_default_select)
rs.Open sql,conn,1,1
while not rs.EOF
third_text = third_text & ""
rs.MoveNext
wend
rs.close
%>