Skip navigation links

MySQL Forums :: MySQL Query Browser :: Query Fails - Need Help Figuring it out


Advanced Search

Re: Query Fails - Need Help Figuring it out
Posted by: Scott Nemes ()
Date: February 10, 2012 10:51AM

The below will work:

create view EmployeeBoss (empoyee_number, employee_name, employee_salary, boss_name) as select empl.empno, empl.empname, empl.empsalary, IF(ISNULL(mgr.empname), "None", mgr.empname) from emp empl left join emp mgr on empl.bossno = mgr.empno;

I added in extra logic to account for employees with no boss, but you should be able to modify it as needed. =)

--
Scott Nemes
MySQL DBA

http://www.linkedin.com/in/scottnemes
http://www.twitter.com/ScottNemes

Options: ReplyQuote


Subject Written By Posted
Query Fails - Need Help Figuring it out C R 02/10/2012 06:38AM
Re: Query Fails - Need Help Figuring it out Scott Nemes 02/10/2012 10:51AM
Re: Query Fails - Need Help Figuring it out C R 02/12/2012 03:56AM


Sorry, you can't reply to this topic. It has been closed.

Content reproduced on this site is the property of the respective copyright holders. It is not reviewed in advance by Oracle and does not necessarily represent the opinion of Oracle or any other party.