select * from [Table] order by Case when Date1 is null then Date2 else Date1 end
解决方案 »
- 如何实现行和列之间的转换
- 求一个人所得税SQL语句.
- mssql关于数据比较的问题
- MSDE的问题·········
- sqlserver2005 报告18456错误 用户sa登录失败
- isdate函数过滤后,结果仍然报char转换datetime越界!!
- 我怎么能在QA中用SELECT INTO语句? The database owner must run sp_dboption to enable this option.
- 在ADO中,如何实现Access2000数据库的链接表操作?
- 请问一下,在SQLSERVER中表名和字段名都用中文,好不好,在线等待
- MS_SQL 2000怎样用sql语句查询索引、主键、唯一约束
- 强大的select语句的问题!!!!!!!!!!!!!!!
- 这个问题如何处理呀?
order by isnull(date1,date2)
create table tb(id int identity(1,1),date1 varchar(100),date2 varchar(100))
insert into tb (date1) values ('08-09')
insert into tb (date1) values ('08-11')
insert into tb (date2) values ('08-10')
select * from tb
select * from tb
order by isnull(date1,date2)
--order by isnull(Date1,'')+isnull(Date2,'')
--order by Case when Date1 is null then Date2 else Date1 end
drop table tb