Hi everyone.
Doesn't it work with order by alias bound to the parameter?
My order by:
ORDER BY CASE
WHEN @ordercolumn = 'Id' THEN Id
WHEN @ordercolumn = 'Username' THEN Username
END
I get error "Ambiguous column name 'Id'"
My select:
SELECT DISTINCT P.Id,
P.Username Username,
………
I can't post the whole code because it's 150 lines but there are no other Id columns in the selection
Sachin SinghPosted Aug 29, 2022, 4:38 AM
Rajanikant HawaldarPosted Aug 28, 2022, 5:18 AM
Uday DodiyaPosted Aug 28, 2022, 5:00 AM