I want to add the sum values of a column, but only select the distinct values of another. So basically I want to combine the two SQL statements:
"SELECT DISTINCT question_id FROM test_submissions"
"SELECT SUM(correct) AS count FROM test_submissions"
I only want to select the SUM(correct) for one of the question_id's, not multiples. So if there's two or three rows with the same question_id, I only want the query to select one of them, and if possible, I would like it to select the one where correct=1, as opposed to correct=0.
I just don't know how to go about combining the two and achieving this. Any suggestions?