select * from ktv_info where city  in ('592,591')
  order by city desc

解决方案 »

  1.   


    --1
    select * from tb where city = '592'
    union all
    select * from tb where city <> '592'--2
    select * from tb order by case city when '592' then 1 else 2 end
      

  2.   

    select * from tb where city = '592'
    union all
    select * from tb where city <> '592'可实现但如用hibernate就不行了,用hibernate要怎样查询呢
      

  3.   

    public List<KtvInfo> getRingbycity1(String city){
    System.out.print("====civvty==="+city);
    List<KtvInfo> l =ktvInfoDao.find("from KtvInfo where city='592' union all from KtvInfo where city<>'592' ", null);
        if(l.size()>0)
         return l;
        else
         return null;
    }用上面的hibernate只能查询出from KtvInfo where city='592'
      

  4.   

    find("from KtvInfo   order by case when city = '592' then 0 else 1 end",null);