今天有個(gè)需求:客戶要求在排序的時(shí)候把空值(null)放在最前面。
以前沒注意過(guò)這個(gè)問題,翻了一下資料,
用 nulls first解決問題。
order??by?lower(course_code)?asc?nulls?first
這樣查詢結(jié)果,就會(huì)把空值放到最上面
order??by?lower(course_code)?asc?nulls?Last
這個(gè)是把空值放在最后面,默認(rèn)就是這樣
貼在這里mark一下,也順便給需要的兄弟。
posted on 2007-07-09 15:14
交口稱贊 閱讀(682)
評(píng)論(2) 編輯 收藏 所屬分類:
數(shù)據(jù)庫(kù)