order by语句涉及到null问题 select * from table order by rtrim(ltrim(col1)) desc 解决方案 » 免费领取超大流量手机卡,每月29元包185G流量+100分钟通话, 中国电信官方发货 select * from table where fieldname<>null order by col1 asc union allselect * from table where fieldname=null我觉得有更好的函数能实现,笨办法:) select * from yourtable where colname=nullunion allselect * from yourtable where colname<>null order by col asc select * from table where fieldname is not null order by col1 asc union allselect * from table where fieldname is null select * from table order by isnull(col1,0)select * from table order by isnull(col1,0) desc :) select * from table order by (case when col1 is null then 1 when rtrim(ltrim(col1))='' then 1 else 0 end ),col1 求一SQL语句,多条明细体现在一条记录上 为什么sql企业管理器工具浏览表时无法展开列 sql server 2000的数据库中表的主键只能为一个字段吗? SQL相同产品相同 救命呀,在线等 嘿嘿 大虾门解决下呵呵 问一个变量赋值的问题。 求一个SQL? BDE的乱码问题 如何在SQL Server 2000中自动把数据备份到网络上另一台机器? 如何生成一个自定义的sql文件? 关于在数据库设计时的问题!
union all
select * from table where fieldname=null我觉得有更好的函数能实现,笨办法:)
select * from yourtable where colname=null
union all
select * from yourtable where colname<>null order by col asc
union all
select * from table where fieldname is null
select * from table order by isnull(col1,0) desc
:)
from table
order by (case
when col1 is null then 1
when rtrim(ltrim(col1))='' then 1
else 0
end ),col1