日期:2014-05-18 浏览次数:20759 次
--原始数据:#T
create table #T(id int,photo varchar(11),name varchar(5),number int)
insert #T
select 1,'','jack',123 union all
select 2,'','shmit',789 union all
select 3,'pic\pic.gif','join',456
--查询成本:39.43%
select * from #T order by case photo when '' then 1 else 0 end
--查询成本:60.57%
select * from #T where photo<>''
union all
select * from #T where photo=''
--删除测试
drop table #T