The attached image is what I have in my DB table. I wished to count the number of “IsRead” that are true for a unique productSerial. The productSerial here is not a primary key, hence it can be repeated. But I was unsure how to write the sql statement for this..
For example the result should be displayed like :
10 - 3
11 - 2
12 - 1
I came out with this but I wondered whether it was correct, and hope u all can correct me if i am wrong.
Select DISTINCT productSerial
FROM (SELECT COUNT(IsRead) where IsRead = 'True' FROM testing);

1 Answer