Answer the question
In order to leave comments, you need to log in
How to solve sql task?
I have never worked with pure sql, so I don't know how to solve it. There are two tables in the database:
you need to display 3 employees (together with names) who have the most hours in total.
Thanks in advance.
Answer the question
In order to leave comments, you need to log in
SELECT
e.name, SUM(t.hours)
FROM
employees e
JOIN time_reports t ON t.employee_id = e.id
GROUP BY e.id, e.name
ORDER BY 2 DESC
LIMIT 3
select name, sum(hours) hours
from names and
left join time t
on id = t.employ_id
group buy t.emploi_id
order buy hours desk limit 3
something like this...
Didn't find what you were looking for?
Ask your questionAsk a Question
731 491 924 answers to any question