I have an SQL table:
+-------------+-----------+---------+
| ID | position | user |
+-------------+-----------+---------+
| 1 | 1 | 0 |
| 2 | 2 | 0 |
| 3 | 3 | 0 |
| 4 | 4 | 0 |
| 5 | 5 | 0 |
| 6 | 6 | 0 |
| 7 | 7 | 0 |
| 8 | 7 | 1 |
+-------------+-----------+---------+
I would like to filter the duplicate row based on position column and the distinct value of user column, for the first query I need to have the following result:
+-------------+-----------+---------+
| ID | position | user |
+-------------+-----------+---------+
| 1 | 1 | 0 |
| 2 | 2 | 0 |
| 3 | 3 | 0 |
| 4 | 4 | 0 |
| 5 | 5 | 0 |
| 6 | 6 | 0 |
| 8 | 7 | 1 |
+-------------+-----------+---------+
For the second query I need the following:
+-------------+-----------+---------+
| ID | position | user |
+-------------+-----------+---------+
| 1 | 1 | 0 |
| 2 | 2 | 0 |
| 3 | 3 | 0 |
| 4 | 4 | 0 |
| 5 | 5 | 0 |
| 6 | 6 | 0 |
| 7 | 7 | 0 |
+-------------+-----------+---------+
What queries do I need to achieve this?
Thanks.