reverse group by in mysql

Collapse
X
 
  • Time
  • Show
Clear All
new posts
  • itnassol
    New Member
    • Nov 2008
    • 2

    reverse group by in mysql

    Hi again,

    is it possible to change the order of GROUP BY.

    e.g. i have 3 rows of data all related to unit number 313025 as below

    313025 - Red - Yellow - NoData
    313025 - Red - Green - Green
    313025 Green - Green - Green

    When i do a GROUP BY Unit i get the following

    313025 - Red - Yellow - NoData

    or the fist one in the group that was entered, what i want is on a GROUP BY for it to show up the last record

    Any ideas would be great

    Thanks

    Andrew
  • mwasif
    Recognized Expert Contributor
    • Jul 2006
    • 802

    #2
    This is called groupwise maximum. Take a look at this article.

    Comment

    Working...