I want to display Alias name based on the value of some other column name in the query in SQL Server. For e.g.
SELECT P.Amount AS (CASE P.Type WHEN 'Individual' THEN 'Salary' ELSE 'Profit' END)
FROM Person P
I know the above is not right, but something like this will help.
I’m not sure if you can add dynamic aliases, but you should be able to do something like this (if you have only a few possible aliases):