W
W
WYBM2021-06-30 13:07:39
SQL
WYBM, 2021-06-30 13:07:39

Displaying all maximum values?

The task specifies to display the value of the employee's highest salary.

SELECT fio AS 'PIB', name_pos AS 'Posada', sum(sal_month) AS'Salary for 2021 rіk'
FROM salary
INNER JOIN employee on salary.id_emp=employee.id_emp
INNER JOIN emp_position on emp_position.id_pos=employee.id_pos
WHERE date_sal BETWEEN '2021-01-01' AND '2021-12-31' GROUP BY
employee.id_emp
ORDER BY sum(sal_month) DESC LIMIT 0.1 case took them all out.

Answer the question

In order to leave comments, you need to log in

1 answer(s)
A
Akina, 2021-06-30
@Akina

SELECT * 
FROM table t1
WHERE NOT EXISTS ( SELECT NULL
                   FROM table t2
                   WHERE t1.salary < t2.salary )

Well, or translated into Russian - withdraw all employees for whom there is no employee with a larger paycheck.

Didn't find what you were looking for?

Ask your question

Ask a Question

731 491 924 answers to any question