With the following table (assuming it has many other rows and columns), how could I query it while removing duplicates?
order_id | customer_name | amount | bill_type |
---|---|---|---|
1 | Chris | 10 | sale |
1 | Chris | 1 | tip |
1 | Chris | 10 | sale |
Note that while all 3 rows are about the same order, only row 3 is a duplicate -- since row 2 tells us about the tips of that order.
Using distinct order_id
would remove rows 2 and 3, while I am looking to only remove row 3.
Appreciate any ideas