Sobes.tech
Назад к вопросам
Middle
6

SELECT * FROM table1 AS t1 LEFT JOIN table2 AS t2 ON t1.date_start > t2.date_start --DML CREATE TABLE IF NOT EXISTS Employee (id int, salary int, departmentId int); INSERT INTO Employee (id,salary,departmentId) VALUES (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); with cte as( select *, rank() over(partition by departmentId order by salary desc) as max_salary from Employee ) select * from cte where max_salary = 1

Компании, где спрашивали
Леман про