I have table to track the success, failure of students taking exam in a course as follows.
Column | Type | Modifiers
------------+---------+---------------------------------------------------------
id | integer | not null default nextval('assessment_id_seq'::regclass)
student_id | integer | not null
lesson_id | integer | not null
correct | boolean | default false
Now, I need to generate a report of the students. Report just shows the number of attempts as total, and number of correct ones as score - per lesson.
select count(*) as score from assessment where correct = true and student_id = 1 group by lesson_id
select count(*) as total_attempts from assessment where student_id = 1 group by lesson_id .
I would like to combine these two queries to a single query. How can i do this..
Thanks.