如何在(order by)上添加多个order by row\ U number
我有这个代码,但似乎不起作用
;WITH CTE_Results AS
(
SELECT ROW_NUMBER() OVER (ORDER BY
CASE WHEN @lSortCol = @firstNameLit AND @sortDirection=@ascLit THEN [FirstName] END ASC,
CASE WHEN @lSortCol = @firstNameLit AND @sortDirection=@descLit THEN [FirstName] END DESC,
CASE WHEN @lSortCol = @lastNameLit AND @sortDirection=@ascLit THEN [LastName] END ASC,
CASE WHEN @lSortCol = @lastNameLit AND @sortDirection=@descLit THEN [LastName] END DESC,
--Sort Column no match
CASE WHEN @sortDirection=@ascLit THEN [LastName] END ASC, [FirstName] ASC, --This doesn't work
CASE WHEN @sortDirection=@descLit THEN [LastName] END DESC, [FirstName] ASC --This doesn't work
暂无答案!
目前还没有任何答案,快来回答吧!