如何用SQL語句查詢Table表中的ID1中的O1,O2,O3為1 的數目
Table
ID O1 O2 O3
ID1 1 1 0
ID2 1 0 1
ID3 0 1 1
select COUNT(*), (select COUNT(*) FROM a where O1='1') AS COUNTO1,(SELECT COUNT(*) FROM A WHERE O2="1") AS COUNTO2 ,(SELECT COUNT(*) FROM A WHERE O3="1") AS COUNT03 FROM A