select top 7 tgbs as bs,tgbt as bt from tgsp where status = 1 and tjxh != null and tjxh !=0 order by case when tjxh is not null then 0 else 1 end, tjxh 

解决方案 »

  1.   

    order by case when tjxh is null then 1 else 0 end,tjxh 
      

  2.   

    select top 7 tgbs as bs,tgbt as bt from tgsp where status = 1 and tjxh IS NOT null and tjxh !=0 order by case when tjxh is not null then 0 else 1 end, tjxh 
      

  3.   

    order by case when tjxh is null then 1 else 0 end,tjxh 
      

  4.   


    select top 7 tgbs as bs,tgbt as bt from tgsp where status = 1 
    order by case when tjxh is null then 1 when tjxh=0 then 1 else 0 end