Saturday, 24 March 2012

sql query to display parent name as manager if parent id is null


select e2.id,e2.name,isnull(e1.name,'Manager') as parentname
from emp e1
right outer join emp e2 on e2.parentId=e1.Id

No comments:

Post a Comment