Max sal to print base on manager_id

Possible would be a subselect inside the select (although a bit slow as all subselects are):

select id, mgr_id, sal, (select max(sal) from mytable n2 
where n2.mgr_id = mytable.mgr_id) as max_sal from mytable 

Leave a Comment