You are viewing a single comment's thread. Return to all comments →
WITH name_salary AS ( SELECT s.id AS n_id, s.name AS name, p.salary AS nsalary FROM Students s JOIN Packages p USING (id) ), friend_salary AS ( SELECT f.id AS id, f.friend_id AS f_id, p.salary AS fsalary FROM Friends f JOIN Packages p ON f.friend_id = p.id ) SELECT ns.name FROM name_salary ns JOIN friend_salary fs ON ns.n_id = fs.id WHERE fs.fsalary > ns.nsalary ORDER BY fs.fsalary;
Seems like cookies are disabled on this browser, please enable them to open this website
Symmetric Pairs
You are viewing a single comment's thread. Return to all comments →