Johan Höök wrote:

Hi Gobi,
there was a similar posting in august.
See:
http://lists.mysql.com/mysql/187436
which I think describes what you want.
I'll include a bit of it here as well
----------

This is out of the MySQL class and is called the Max-Concat trick.
________________________________________________________________________
____
What is the biggest country in each continent?
"The Rows Holding the Group-wise Maximum of a Certain Field"

MySQL> Select Continent,
    ->  SUBSTRING(MAX(CONCAT(LPAD(Population,10,'0'),Name)),11) AS
Country,
    ->     0+LEFT(MAX(CONCAT(LPAD(Population,10,'0'),Name)),10) AS
Population
    -> From Country
    -> Group By Continent
    -> Order By Population DESC;
-------------

/Johan


Actually, taking a closer look at your link, I think my query is slightly different from Kemin's. Kemin was trying to get the top numbers from col2 AND col3 together. Therefore, in his original statement, he was trying to order both col2 and col3 in descending order.

Me, I just want to get the most recent date for each unique VBS_ID. I don't need to get the max weight so I am not sure if it is necessary to concat my date and weight together. Comments?

--
MySQL General Mailing List
For list archives: http://lists.mysql.com/mysql
To unsubscribe:    http://lists.mysql.com/[EMAIL PROTECTED]

Reply via email to