So if I have a table like this
id | value | detail
-------------------
12 | 20 | orange
12 | 30 | orange
13 | 16 | purple
14 | 50 | red
12 | 60 | blue
How can I get it to return this?
12 | 20 | orange
13 | 16 | purple
14 | 50 | red
If I group by id and detail it returns both 12 | 20 | orange and 12 | 60 | blue
SQL Fiddle
PostgreSQL 9.3 Schema Setup:
Query 1:
Not sure if Redshift supports this syntax:
Results:
Query 2:
Results: