select seq_no from 表1 WHERE SE_NO ='202'
select UPD_ID from 表2 where table_no='1' and type='1' and seq_no ='"& seq_no &"'
select USERNAME from 表3 where USER_ID ='"& UPD_ID &"' 

解决方案 »

  1.   

    select 表1.seq_no,表2.UPD_ID,表3.USERNAME from 表1,表2,表3 where 表1.seq_no =表2.seq_no and 表2.UPD_ID = 表3.USER_ID and 表1.SE_NO=‘202’ and 表2.table_no ='1' and 表2.type='1'   
      

  2.   

    select USERNAME from 表1 a,表2 b,表3 c where a.seq_no=b.seq_no and b.UPD_ID=b.UPD_ID and a.SE_NO ='202'
      

  3.   

    select 
    t1.seq_no,
    t2.UPD_ID,
    t3.USERNAME  
    from 表1 t1,表2 t2,表3 t3
    WHERE t1.SE_NO ='202' 
    and t2.table_no='1' and  t2.type='1' and t2.seq_no =t1.seq_no 
    and t3.USER_ID =t2.USER_ID
      

  4.   

    我这样写结果是正确的,总感觉别扭,那位能否改进下
    select USER_NAME
             from 表3
             where USER_ID = (select UPD_WHO from 表2 where no='1' and type='1' 
             and seq_no = (select seq_no from 表1 WHERE SE_NO ='202') )
      

  5.   

    不会就用inselect USERNAME from 表3 where USER_ID in (
    select UPD_ID from 表2 where table_no='1' and type='1' and seq_no in (
    select seq_no from 表1 WHERE SE_NO ='202'
    )
    )
      

  6.   

    select a.USERNAME
      from 表2 a, 表3 b, 表1 c
     where 1 = 1
       and a.UPD_ID = b.USER_ID
       and a.seq_no = c.seq_no
       and a.table_no = '1'
       and a.type = '1'
       and c.SE_NO = '202'
       
       --a.UPD_ID , b.USER_ID, a.seq_no , c.seq_no  这几个地段注意加索引