use expressions in the ORDER BY Clause

Bageshkumarbagi
Posted by Bageshkumarbagi under Sql Server category on | Points: 40 | Views : 765
Hi,

Here i have written a sql how to use expressions in the ORDER BY Clause


SELECT name, salary, salary*1.5 AS new_salary
FROM emp
WHERE salary*1.5 > 30000 AND dept='MCA'
ORDER BY new_salary DESC;

************OUTPUT*****************

name salary new_salary
----------- ---------- ----------------
Ramesh 32000 48000
Bagesh 30000 45000
Rajesh 25000 37500

Comments or Responses

Login to post response