Hi, can i ask some help,How can i do this in my sql query to have Case statement?
Example in my employee table i want to have case statement on my empno.
select * from employee
when empno = "000070" then firstname = "Jack"
when empno = "000050" then firstnmae = "Stellar"
when empno = "000030" then firstname = "Sheek"
else firstname = "jemz"
can you help me please i am confuse in my querry.
Thank you in advance.:)
how hard did you try to look up the actual syntax and learn from the examples?
CASE WHEN empno = '000070' THEN 'Jack'
WHEN empno = '000050' THEN 'Stellar'
WHEN empno = '000030' THEN 'Sheek'
END AS firstname
also, the CASE expression is not allowed to some after the FROM clause
Actually i haven't see good example for this kind of problem
here you go --> http://www.devshed.com/c/a/MySQL/Advanced-Query-Writing-concluded/2/
This topic is now closed. New replies are no longer allowed.