We use cookies to ensure you have the best browsing experience on our website. Please read our cookie policy for more information about how we use cookies.
with cte_cal as (
select
f.id,
P.salary,
dp.id as friendid,
dp.salary as friedsal,
s.name as name
from Friends F
INNER JOIN Packages P ON P.id = F.ID
INNER JOIN Packages dP ON dP.id = F.Friend_ID
INNER JOIN Students S ON S.id = P.id
)
select name from cte_cal
where salary < friedsal
order by friedsal ASC
Cookie support is required to access HackerRank
Seems like cookies are disabled on this browser, please enable them to open this website
Placements
You are viewing a single comment's thread. Return to all comments →
with cte_cal as ( select f.id, P.salary, dp.id as friendid, dp.salary as friedsal, s.name as name from Friends F INNER JOIN Packages P ON P.id = F.ID INNER JOIN Packages dP ON dP.id = F.Friend_ID INNER JOIN Students S ON S.id = P.id )
select name from cte_cal where salary < friedsal order by friedsal ASC