select * into c from a where birth_date>='2008-10-01' and flag='1'
select b.*,c.* from b inner join c on c.id=b.id  where b.num=1 and b.sex='1' and b.birth_date<>c.birth_date
如果不用c表,该怎么写?

解决方案 »

  1.   


    select b.*,c.* from b inner join
    (select * from a where birth_date>='2008-10-01' and flag='1') c on c.id=b.id where b.num=1 and b.sex='1' and b.birth_date<>c.birth_date
      

  2.   

    select b.*,c.* from b 
    inner join (select *  from a where birth_date>='2008-10-01' and flag='1')c 
    on c.id=b.id 
    where b.num=1 and b.sex='1' 
    and b.birth_date<>c.birth_date