Click here to Skip to main content
15,904,817 members
Please Sign up or sign in to vote.
0.00/5 (No votes)
See more:
I have a database for a fishing company, I have a staff table and I want to increase the wages for the employees depending on their role. I made an SQL Statement but it doesn't work, it just comes up with blank fields.

Heres my statement:

SELECT FirstName, Surname, (Wages * 1.15) as newwages from Staff where StaffRole = 'Admin';
Posted

There appears to be something wrong with your where statement.
Make sure there are rows with StaffRole as Admin. Also, check the case of the the staffrole column values.
 
Share this answer
 
Comments
programmer1234 12-Dec-11 12:36pm    
found out I put the staff role names in the wrong column my bad lol
Monjurul Habib 12-Dec-11 12:54pm    
5!
Abhinav S 12-Dec-11 12:57pm    
Thank you Monjurul.
try with this..

select FirstName,SurName, case when staffrole='a' then wages*100
when staffrole='b' then wages*200
end as 'New Wages'
from TableName;


U can get the required output....
 
Share this answer
 
Comments
Sandeep Mewara 29-Jun-12 6:54am    
OP already found the issue and resolved it 7 months back. See first comment to answer on what was his issue.
dharan1990 29-Jun-12 8:23am    
I knew its already solved but iam providing my answer ...

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