Re: [GENERAL] SQL query problem of a Quiz program

2016-12-17 Thread Torsten Förtsch
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

Re: [GENERAL] SQL query problem of a Quiz program

2016-12-17 Thread Adrian Klaver
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 |

Re: [GENERAL] SQL query problem of a Quiz program

2016-12-17 Thread Melvin Davidson
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 |

[GENERAL] SQL query problem of a Quiz program

2016-12-17 Thread Arup Rakshit
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