oracle中如何给有空值的数据排序

可以使用 nulls first 和 nulls last 把空值行排到前面和后面,例:

1 select PatientName,BedNo
2  from T_PatientInHospital
3 where DepartmentCode='0608'
4 order by to_number(BedNo) nulls first

1 select PatientName,BedNo
2 from T_PatientInHospital
3 where DepartmentCode='0608'
4 order by to_number(BedNo) nulls last


posted @ 2011-03-10 16:39  qing_sun  阅读(383)  评论(0编辑  收藏  举报