select * from table1 a,table2 b where a.id=b.id and b.dy='是'

解决方案 »

  1.   

    select t1.gr from table1 t1,table2 t2 where t1.id=t2.id
      

  2.   

    select * from table1 a
    where exists (
    select * from table2
    where id=a.id and dy=1
    )
      

  3.   

    select * from table1 as t1 
    inner join table2 as t2
    where t1.id=t2.id and t2.dy=1
      

  4.   

    select a.id,a.gr from table1 a,table2 b where a.id=b.id
      

  5.   

    select * from table1 a,table2 b where a.id=b.id and b.dy='是'
      

  6.   

    select * from table1 a,table2 b
    where a.id=b.id
    order by b.dy (因为不知道DY的数据类型)
      

  7.   

    a表id为gr id,
    b表id为dy id
    id 可能不同,但是姓名应该相同,如张三。
    select * from table a join table b 
    where a.gr=b.dy