Hi @vissupangam-0394 ,
I did a local test,hope will help you.
with cte as(select distinct managename from employTest as emp1 where not exists (select managename from employTest as emp2 where emp1.managename = emp2.managename and empstatus = 'Rejected') )
select '' as empname,'Approved' as statuss ,* from cte
union
select employname, empstatus,managename from employTest where empstatus = 'Rejected'
Best Regards,
Isabella
If the answer is helpful, please click "Accept Answer" and upvote it.
Note: Please follow the steps in our documentation to enable e-mail notifications if you want to receive the related email notification for this thread.