SyntaxFix
Write A Post
Hire A Developer
Questions
It should work. Try this
Select * from (select col1, col2, case when 1=1 then 'ok' end as alias_col from table) as tmp_table order by case when @sortBy = 1 then tmp_table.alias_col end asc