How can I SELECT rows with MAX(Column value), DISTINCT by another column in SQL?
Hello, I am doing something extremely similar to this above.
I would like 1 table that contains the entire rows of mins and maxes of each group merged into each row. In this example, I would like for it to be player, max.id, max.home, max.datetime, max.resource, min.id, min.home, min.datetime, min.resource.
Thank you so much.
Here is my code so far (which gave me all rows of the maximum):
SELECT tt.*
FROM topten tt
INNER JOIN
(SELECT home, MAX(datetime) AS MaxDateTime
FROM topten
GROUP BY home) groupedtt
ON tt.home = groupedtt.home
AND tt.datetime = groupedtt.MaxDateTime