Answer the question
In order to leave comments, you need to log in
Why doesn't output sql in descending order?
select DATE_FORMAT( time_reports.date, '%W'), group_concat(employees.name, ' (', x.total_hours, ' hours)' SEPARATOR ', ' LIMIT 3)
from employees
inner join time_reports on employees.id=time_reports.employee_id
inner join
(
select employee_id, round(hours,2) as total_hours
from time_reports group by employee_id
ORDER BY total_hours DESC
)x on x.employee_id=time_reports.employee_id
group by time_reports.date
Answer the question
In order to leave comments, you need to log in
select DATE_FORMAT( time_reports.date, '%W'), group_concat(employees.name, ' (', x.total_hours, ' hours)' order by x.total_hours desc SEPARATOR ', ' LIMIT 3)
because in the resulting selection no sorting order is explicitly specified, and there is no such field at all.
Didn't find what you were looking for?
Ask your questionAsk a Question
731 491 924 answers to any question