Query the row with the greatest/least value per group.
My table looks something like this: group date cash checks 1 1/1/2013 0 0 2 1/1/2013 0 800 1 1/3/2013 0 700 3 1/1/2013 0 600 1 1/2/2013 0 400 3 1/5/2013 0 200 -- Do not need cash just demonstrating that table has …
sql sql-server-2005 greatest-n-per-groupThe following query: SELECT year, id, rate FROM h WHERE year BETWEEN 2000 AND 2009 AND id IN (SELECT rid FROM table2) …
sql mysql greatest-n-per-group rankingI'm trying to list the latest destination (MAX departure time) for each train in a table, for example: Train Dest …
sql oracle group-by greatest-n-per-group ora-00979How do you get the rows that contain the max value for each grouped set? I've seen some overly-complicated variations …
mysql sql greatest-n-per-groupI have a table ("lms_attendance") of users' check-in and out times that looks like this: id user time io (…
mysql sql greatest-n-per-groupSuppose I have a table of customers and a table of purchases. Each purchase belongs to one customer. I want …
sql select join indexing greatest-n-per-groupI have a table of sensor data. Each row has a sensor id, a timestamp, and other fields. I want …
sql greatest-n-per-groupMy table looks like this (and I'm using MySQL): m_id | v_id | timestamp ------------------------ 6 | 1 | 1333635317 34 | 1 | 1333635323 34 | 1 | 1333635336 6 | 1 | 1333635343 6 | 1 | 1333635349 My target is to take …
mysql sql group-by greatest-n-per-groupI want an SQL statement to get the row with a minimum value. Consider this table: id game point 1 x 5 1 …
sql database greatest-n-per-groupThe following is the simplest possible example, though any solution should be able to scale to however many n top …
mysql sql greatest-n-per-group mysql-variables