How to use column alias to calculate other column value
3
votes
3
answers
19743
views
My query is
SELECT
(
house_rent
+conveyance
+medical
+dearness
+others_allowances
) AS earnings
,(income_tax
+pro_tax
+emp_state_insu
+absence_fine
+others_deductions
) AS deductions
,(earnings - deductions) AS net_salary
FROM
salary
and im getting an error that unknown column earnings and deductions because these are column alias not column name ..
Any solution?
Thanks in advance
Asked by Tanveer Jafri
(35 rep)
Dec 12, 2018, 10:38 AM
Last activity: Dec 12, 2018, 01:15 PM
Last activity: Dec 12, 2018, 01:15 PM