Untitled

mail@pastecode.io avatar
unknown
plain_text
2 years ago
224 B
1
Indexable
Never
SELECT students.name
FROM ( students JOIN friends USING(ID)
       JOIN packages stu ON students.ID = stu.ID
       JOIN packages fren ON friends.friend_ID = fren.ID)
WHERE fren.salary > stu.salary
ORDER BY fren.salary;