Query the row with the greatest/least value per group.
I have two models A and B. All B objects have a foreign key to an A object. Given a …
python django django-queryset greatest-n-per-groupThere are two SQL tables: Parents: +--+---------+ |id| text | +--+---------+ | 1| Blah | | 2| Blah2 | | 3| Blah3 | +--+---------+ Childs +--+------+…
sql sql-server tsql greatest-n-per-groupI have a table with user comments in a guestbook. Columns are: id, user_id, title, comment, timestamp. I need …
sql oracle greatest-n-per-groupI've seen solutions for something similar on other posts, but I've been having an issue applying it to my specific …
sql max greatest-n-per-groupAssume I have a data.table containing some baseball players: library(plyr) library(data.table) bdt <- as.data.…
r data.table greatest-n-per-groupI'm new to Postgres, coming from MySQL and hoping that one of y'all would be able to help me out. …
sql postgresql group-by aggregate greatest-n-per-groupFor the following query I need to select only the first record with the lowest shape_type value (ranges from 1 …
sql postgresql distinct greatest-n-per-group distinct-onI have the following data in a matches table: 5;{"Id":1,"Teams":[{"Name":"TeamA","Players":[{"Name":"AAA"},{"Name":"BBB"}]},{"Name":"TeamB","…
sql json postgresql greatest-n-per-group lateralI have a database of items. Each item is categorized with a category ID from a category table. I am …
sql mysql greatest-n-per-groupI am trying to find the second largest value in a column and only the second largest value. select a.…
sql postgresql greatest-n-per-group