Query the row with the greatest/least value per group.
My table is: id home datetime player resource ---|-----|------------|--------|--------- 1 | 10 | 04/03/2009 | john | 399 2 | 11 | 04/03/2009 | juliet | 244 5 | 12 | 04/03/2009 | borat | 555 3 | 10 | 03/03/2009 | john | 300 4 | 11 | 03/03/2009 | juliet | 200 6 | 12 | 03/03/2009 | borat | 500 7 | 13 | 24/12/2008 | borat | 600 8 | 13 | 01/01/2009 | …
mysql sql max distinct greatest-n-per-groupI have this table for documents (simplified version here): +------+-------+--------------------------------------+ | id | rev | content | +------+-------+--------------------------------------+ | 1 | 1 | ... | | 2 | 1 | ... | | 1 | 2 | ... | | 1 | 3 | ... | +------+-------+…
mysql sql aggregate-functions greatest-n-per-group groupwise-maximumAs the title suggests, I'd like to select the first row of each set of rows grouped with a GROUP …
sql sqlite postgresql group-by greatest-n-per-groupI have a table that is a collection entries as to when a user was logged on. username, date, value …
sql greatest-n-per-groupThere is a table messages that contains data as shown below: Id Name Other_Columns ------------------------- 1 A A_data_1 2 A …
sql mysql group-by greatest-n-per-groupHow do I do the following? select top 1 Fname from MyTbl In Oracle 11g?
sql oracle oracle11g greatest-n-per-groupI have a table which I want to get the latest entry for each group. Here's the table: DocumentStatusLogs Table |…
sql tsql sql-server-2005 group-by greatest-n-per-groupTable: UserId, Value, Date. I want to get the UserId, Value for the max(Date) for each UserId. That is, …
sql oracle greatest-n-per-groupIs there a nice way in MySQL to replicate the SQL Server function ROW_NUMBER()? For example: SELECT col1, col2, …
mysql sql greatest-n-per-group rank row-numberI want to return top 10 records from each section in one query. Can anyone help with how to do it? …
sql sql-server sql-server-2005 greatest-n-per-group