I need to perform a group by, but only on rows that meet a condition, otherwise return all rows that do not meet the condition. For example, in the following table, I want to group only rows that have '1' in the "active" field, and return all rows that do not.
TABLE (id, label, active):
1, A, 1
2, A, 1
3, B, 0
4, B, 0
Would return:
1, A, 1
3, B, 0
4, B, 0