Not seeing this on the list 1.5 hrs after posting, I thought I'd try again. Sorry if this is a duplicate...

Jeff

=========

Hi All,

I have a table which contains (among other things), a "name" column and a "version" column (a software asset table). I need a query that will group all like "names" together in a single record, and return the latest "version" (the largest value) for each group. What I have so far is this:

SELECT name, version
FROM asset
GROUP BY name
ORDER BY name ASC, version DESC

While the above seems to return the expected results, I'm not convinced that I'm actually controlling the sort order, as changing "version DESC" to "version ASC" does not return the *earliest* version as I'd expect. I assume the record that will be returned has already been selected at the "GROUP BY" stage and therefore I have no control over it at the "ORDER BY" stage? I know, I need to do some more reading... ;^)

Thanks for any input.

Jeff

-----------------------------------------------------------------------------
To unsubscribe, send email to [EMAIL PROTECTED]
-----------------------------------------------------------------------------

Reply via email to