SQL: Select only rows with Max Value on a Column(stackoverflow.com) |
SQL: Select only rows with Max Value on a Column(stackoverflow.com) |
ROW_NUMBER() OVER(PARTITION BY Id ORDER BY Rev DESC) AS "Row Number"
Returns 1 is clearer to my mind, with some caveats around dialects which use separate forms of row-number that assign identical/differing numbers to two consecutive identical rows.
I hate joins. Subselects are so much clearer imo - and you don't end up with extra fields.