Grouped Filtering

We wish to apply a filter to the groups of a column table, i.e. the sub tables defined by the values of a column, rather than the table as a whole.

This section is organized as follows:

  • By Value where we cover filtering the rows of each group by a logical expression that involves comparing the value of one or more columns to a quantity computed for the group. For instance; how to return rows where a numeric column takes a value greater than the mean of the group.
  • By Position where we cover filtering rows by their position (row number) in the group. For instance; how to return the first row from each group.
  • By Rank where we cover filtering rows by the rank of a value of a specific column. For instance; how to return the row where a particular column has its maximum value for each group.
  • By Group where we cover filtering a grouped table to keep only the groups that meet certain criteria. For instance, how to retain groups with more than 1 row.
SQL
I/O