Did you try DISTINCT ON?
postgres=# table x;
id | qid | uid
+-+
1 | 25 | 1
2 | 25 | 1
3 | 25 | 1
4 | 26 | 1
5 | 26 | 1
6 | 27 | 1
7 | 27 | 1
8 | 25 | 2
9 | 25 | 2
10 | 25 | 2
11 | 26 | 2
12 | 26 | 2
1
On 12/17/2016 07:25 AM, Arup Rakshit wrote:
Hi,
Here is a sample data from table "quiz_results":
id | question_id | user_id
+-+
2 | 25 | 5142670086
3 | 26 |
4 | 26 |
5 | 27 |
6 | 25 | 5142670086
7 | 2
On Sat, Dec 17, 2016 at 10:25 AM, Arup Rakshit
wrote:
> Hi,
>
> Here is a sample data from table "quiz_results":
>
> id | question_id | user_id
> +-+
> 2 | 25 | 5142670086
> 3 | 26 |
> 4 | 26 |
> 5 | 27 |
> 6 | 25
Hi,
Here is a sample data from table "quiz_results":
id | question_id | user_id
+-+
2 | 25 | 5142670086
3 | 26 |
4 | 26 |
5 | 27 |
6 | 25 | 5142670086
7 | 25 | 5142670086
8 | 25 | 5142670086