+ 3

Regarding practise question 'Annual bonuses ' in sql. Would like to know how to resolve the same using "Where" condition?

The code with which I got the correct result: SELECT CONCAT (firstname, ' ' ,lastname) AS fullname ,salary*12+(experience*500) as total FROM staff ORDER BY total I tried using SELECT CONCAT (firstname, ' ' ,lastname) AS fullname ,salary as total FROM staff WHERE salary= salary*12+(experience*500) ORDER BY total; got an error at the where statement

12th Jan 2022, 7:56 PM
Anuchitra Arumugam
Anuchitra Arumugam - avatar
1 Respuesta
+ 1
I can't see the specific issue, though I do know WHERE can be quite picky about what it accepts, I do notice that your SQL will return the original value for salary, whereas there's returns a modified value, so even had it not errored it still wouldn't have been correct
13th Jan 2022, 9:40 AM
AnonyMouse
AnonyMouse - avatar