Announcement

Collapse
No announcement yet.

Sorting items in select list

Collapse
X
  • Filter
  • Time
  • Show
Clear All
new posts

  • Sorting items in select list

    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

  • #2
    The select first must have el code and then description, i can see you have projectname as code. it presents a number because you second field is a number
    The select must show,
    cod1 name1
    cod2 name2
    cod3 name3
    cod4 name4
    Last edited by alvagar; 08-03-2014, 10:10 AM.

    Comment


    • #3
      Thank you very much. It is almost hard to believe it was that easy...

      Comment

      Working...
      X