
තෝරන්න *
දත්තසමුදා1 ලෙස t1
වමට JOIN දත්තසමුදා2 ලෙස t2 ON t1.date_start > t2.date_start
--DML
ඉතිරි නොවන්නේ නම් Employee වගුව සෑදීම (id int, salary int, departmentId int);
Employee වෙත ඇතුල් කරන්න (id,salary,departmentId) අගයන් සමඟ (1, 70000, 1),(2, 94000, 1),(3, 85000, 1),(4, 80000, 2),(5, 60000, 2),(6, 62000, 3),(7, 90000, 3),(8, 94000, 3),(9, 94000, 3);
cte ලෙස(
තෝරන්න *,
rank() over(partition by departmentId order by salary desc) ලෙස max_salary
Employee සිට
)
තෝරන්න *
from cte
කොහොමද max_salary = 1