Click here to Skip to main content
16,018,264 members
Please Sign up or sign in to vote.
1.00/5 (2 votes)
See more:
select Eid, EName, ESalary from dbo.tbl_Emp

select Eid, EName, ESalary from dbo.tbl_Emp as BS,
(ESalary+ESalary*0.15+ESalary*0.235) as GS
from dbo.tbl_Emp


--GS=BS+15%BS(HRA)+23.5BS(DA)


Msg 102, Level 15, State 1, Line 4
Incorrect syntax near '+'.

What I have tried:

I tried executing the above query
Posted
Updated 28-Aug-18 5:04am

SELECT 
Eid, EName, ESalary As BS, (ESalary + (ESalary * 0.15) + (ESalary * 0.235)) as GS
FROM 
dbo.tbl_Emp
 
Share this answer
 
Try:
SQL
SELECT Eid, EName, ESalary AS BS,
(ESalary+ESalary*0.15+ESalary*0.235) AS GS
FROM dbo.tbl_Emp
 
Share this answer
 
Comments
MadMyche 28-Aug-18 11:15am    
Given that I came up with the same results, I will not submit another duplicate.
However, I will like to add in that the GS calculation can be simplified using the commutative property into GS = (eSalary * 1.385)

This content, along with any associated source code and files, is licensed under The Code Project Open License (CPOL)



CodeProject, 20 Bay Street, 11th Floor Toronto, Ontario, Canada M5J 2N8 +1 (416) 849-8900