I have a field wich is data type “select” and I have this query in mySQL :
SELECT
projets.nom_projet, COUNT(temps.no_projet) AS occurrence
FROM
temps
INNER JOIN
projets ON projets.no_projet = temps.no_projet
WHERE
temps.no_employe = 41
and DATEDIFF(NOW(), date) < 60
GROUP BY temps.no_projet
ORDER BY occurrence DESC;
I would like to run it in the SQL Select Statement and be able to order it by “occurence” but to present the name (projets.nom_projet).
When I use this statement, the list is ordered by occurence but it presents a number instead of a name.
I doubt it is possible to do as the select list seems to be ordered using the ORDER BY.
If anyone have an idea on how to do it or if you can confirm that it cannot be done, I would be grateful.
Thank you