有两张表 T1, T2T1:
id, name, T2id ,discriptionT2:
id, subName其中 T1的 T2id 与T2的 id 对应想以T1的 name 和 T2的 subName 为 条件 查寻T1的 discripton.
请高手指点如何写 where 条件语句

解决方案 »

  1.   

    select t1.discripton from t1 , t2 where t1.T2id = t2.id and t1.name = ... and t2.subName = '...'
      

  2.   

    select discripton from t1,t2
    where t1.id=t2.id and t1.name='值' and t2.subname='值'
      

  3.   

    SELECT *
    FROM T1
    INNER JOIN T2 ON T1.T2ID=T2.ID
    AND T1.[NAME]='.....' AND T2.SUBNAME='.....'
      

  4.   

    select *
    from t1 a ,t2 b 
    where a.t2id = b.id and (name like '' or subname like '')
      

  5.   

    select t1.id, t1.name, t1.t2id, t1.discription
      from t1 rigth join t2 on t1.name=t2.name;
      

  6.   

    select T1.discripton from
    (
     select * from T1 where name='Name的值'
    ) T 
    join
    (
    select * from T2 where subname='对应的值'
    ) T2
    on T1.T2id=T2.id
      

  7.   

    select t1.discription
      from t1 rigth join t2 on t1.name=t2.name;
      

  8.   

    select 
      *
    from 
      t1 a 
    join t2 b on
      a.t2id=b.id
    where
      a.name=..
    and 
      b.subname=...
      

  9.   

    select t1.discripton
    from t1,t2
    where t1.t2id=t2.id
    and t1.name='xxx'
    and t2.name='yyy'
      

  10.   


    select t1.discripton
    from t1,t2
    where t1.t2id=t2.id
    and t1.name='xxx'
    and t2.subname='yyy'