0
我有此ORDER BY語句:整理與Case語句使兩列用來排序
ORDER BY
CASE WHEN @SortID = 1 AND @SortDirection = 'ASC' THEN ProjectID END ASC,
CASE WHEN @SortID = 1 AND @SortDirection = 'DESC' THEN ProjectID END DESC
我有一個名爲DateSort另一列。我需要的是:
WHEN @SortID = 1 AND @SortDirection = 'ASC' ......我想專案編號升序進行排序,DateSort ASC
WHEN @SortID = 1 AND @SortDirection = 'DESC' ......我想專案編號降序排序,DateSort ASC
即不管專案編號被分類ASC或DESC,我想記錄也由DateSort ASC