select * from 
table1  t1 ,
table2  t2
where 
     t1.id = t2.id(+)
and  t2.seq = (select max(t3.seq) from table2 t3 where t3.id = t2.id)上面这样的写法对应用LEFT JOIN 的写法该如何写?

解决方案 »

  1.   

    select * from 
    table1  t1 
    left join t2 on t1.id=t2.id
    and  t2.seq = (select max(t3.seq) from table2 t3 where t3.id = t2.id) 
      

  2.   

    这个不知道达标不?
    select * from 
    table1  t1 
    left outer join table2 t2 on t1.id=t2.id 
    where t2.seq = (select max(t3.seq) from table2 t3 where t3.id = t2.id)
    or t2.id is null
      

  3.   

    select * from 
    table1  t1 
    left join t2 on t1.id=t2.id 
    and  t2.seq = (select max(t3.seq) from table2 t3 where t3.id = t2.id) 
      

  4.   

    select * from 
    table1  t1 
    left join t2 on t1.id=t2.id 
    where  t2.seq = (select max(t3.seq) from table2 t3 where t3.id = t2.id)