2012年5月9日

SQL Server OrderBy Nulls Last

Oracle的特異功能還真多~ ^^y

很少直接下command了.. ( ̄▽ ̄///) 筆一下
Linq
dcx.Task.Where(t => t.EventId == parentId).OrderBy(t => !t.StartDate.HasValue).ThenBy(t => t.StartDate)

Command
SELECT * FROM Task WHERE EventId=@parentId ORDER BY ISDATE(StartDate) DESC, StartDate

沒有留言: