• + 0 comments

    ngoccth_SQL SERVER: WITH table_1 AS ( SELECT fr.ID, friend_id, name, salary AS salary_id FROM Friends AS fr JOIN Students AS st ON fr.id = st.id JOIN Packages AS pa ON pa.id = fr.id ) SELECT name FROM table_1 JOIN Packages AS pa ON pa.id = table_1.friend_id WHERE salary_id < pa.salary ORDER BY pa.salary