i have a table in sqlite database like following.
id status
=============
x 0
y 1
y 0
x 1
x 1
z 0
As the example, i have 3 different id with status(0/1), and x was found 3 times in the table, with status=0 for 1 time, status=1 for 2 times, y was found 2 times in the table, with status=0 for 1 time and status=1 for 1 time.
so, i want to use ‘select’ to get the following result, is there any way to do this job? any help would be appreciated. thanks
id sum(status=0) sum(status=1) total(status)
========================================================
x 1 2 3
y 1 1 2
z 1 0 1
I believe this should work: