select * from tab1 where gsid in (select gsid from tab2 where ....... ) order by gsid desc

解决方案 »

  1.   

    但这只是GSID满足TAB2的条件,我的意思是
    select * from tab1 orde by gsid in (select gsid from tab2 where ....... )  desc可这样有错
      

  2.   

    select * from tab1 where gsid in (select gsid from tab2 where ....... ) order by gsid desc
    union
    select * from tab1 where gsid not in (select gsid from tab2 where ....... )