strSQL = "select distinct table3.Phone from table3 inner join table2" 
strSQL = strSQL & " on table3.id = table2.phone_id where table2.商品种类id = 1"rst.open strSQL, cnn
do until rst.eof
    list1.additem rst!phone
    rst.movenext
loop
rst.close
set rst  = nothing

解决方案 »

  1.   

    dim rst as adodb.recordset
    set rst=new adodb.recordset
    rst.open "select 表一.商品种类,表二.商品种类id,表二.phone_id,表三.id,表三.phone from 表一,表二,表三 where 表一.商品种类=表二.商品种类id and 表二.phone_id=表三.id"
    do while not rst.eof 
         list1.AddItem rst(4)
         rst.MoveNext
    loop
    rst.close
      

  2.   

    这么麻烦啊,这条语句可不可以?
    SELECT 表三.phone FROM 表三,表二 WHERE 表二.商品种类id=1?
      

  3.   

    select distinct 表三.Phone from 表三 inner join 表二 on 表三.id = 表二.phone_id where 表二.商品种类id = 1
      

  4.   

    strSQL = "select c.phone from 表1 a inner join 表2 b on a.id=b.商品种类id inner   join 表3 c on b.phone_id=c.id where a.商品种类=1"rst.open strSQL, cnn
    do until rst.eof
        list1.additem rst!phone
        rst.movenext
    loop
    rst.close
    set rst  = nothing