Order by is dynamic but the sort order is static.
SELECT ...
Order By CASE WHEN InputParam = 'PRICE' THEN OFFER_PRICE END DESC,
CASE WHEN InputParam = 'ENDING SOON' THEN EXPIRY_DATE END DESC,
CASE WHEN InputParam = 'DISCOUNT' THEN DISC_PERCENTAGE END DESC,
CASE WHEN InputParam = 'SAVING' THEN SAVING END DESC
Now I need to make sure that the sort order is also dynamic. Is there some way to make sort order dynamic in the above query?
See Question&Answers more detail:os