troubleshooting Question

Oracle SQL Help

Avatar of dyarosh
dyarosh asked on
Oracle Database
4 Comments1 Solution326 ViewsLast Modified:
I have a query that I have to build that I need help with.  Here is the basics of the query (? is where I need the help).

SELECT ? AS ManagerName
FROM Employee

ManagerName needs to be pulled from one of two tables.  If the ManagerID in the Employee Table is > 0, the Manager Name is retrieved using this query:
SELECT LastName || ', ' || FirstName FROM Employee WHERE EmployeeID = ManagerID

If the ManagerID in the Employee Table is < 0, the Manager Name is retrieved using this query:
SELELCT TeamName FROM OpenTeam WHERE OpenTeamID = ManagerID

If the ManagerID is 0, the Manager Name should be 'NONE'.

I don't know how to replace the ? with the queries to generate the ManagerName.  Any help is greatly appreciated!
ASKER CERTIFIED SOLUTION
Steve Wales
Senior Database Administrator

Our community of experts have been thoroughly vetted for their expertise and industry experience.

Join our community to see this answer!
Unlock 1 Answer and 4 Comments.
Start Free Trial
Learn from the best

Network and collaborate with thousands of CTOs, CISOs, and IT Pros rooting for you and your success.

Andrew Hancock - VMware vExpert
See if this solution works for you by signing up for a 7 day free trial.
Unlock 1 Answer and 4 Comments.
Try for 7 days

”The time we save is the biggest benefit of E-E to our team. What could take multiple guys 2 hours or more each to find is accessed in around 15 minutes on Experts Exchange.

-Mike Kapnisakis, Warner Bros