I have the table with values as shown in below table:
And I would like to get results as in below table:
I'm trying to query sum of ans1 like this for all rows
`SELECT sub_id, SUM(ans1) FROM booktable WHERE book_id =1 AND sub_id = 4 OR sub_id = 6`
But I'm not getting the expected result as shown in above table, instead I'm getting result for only one value in sub_id column. I'm a beginner in sql, please help. Thanks.