假如按照名字排序,无论升降,名字为空格的数据总在最后~求sql文实现方案。

解决方案 »

  1.   

    order by name = ''
      

  2.   

    select * from 
    (SELECT user_id, user_nm
      FROM m_x_user
      where user_nm is not null 
       order by user_nm DESC) as temp1
    union allselect * from 
    (
    SELECT user_id, user_nm
      FROM m_x_user
      where user_nm = '001' 
       order by user_nm )
    as temp2
      

  3.   

    select * from m_x_user
      where user_nm is not null
    union
    select * from m_x_user
      where user_nm is null
      
    这样简单的写,也可以吧???