MrTV
asked on
sql statement for count in mysql
SELECT `Ssurname`
, SUM(CASE WHEN ((`status`= '11' ) or (`status`= '12' ) ) THEN 1 ELSE 0 END) as Rows_Status_11
, SUM(CASE WHEN ((`status`!= '11' ) AND(`status`!= '12' ) ) THEN 1 ELSE 0 END) as Rows_Status_not_11,(select count(*) as tol where ( (`status`= '11' ) or (`status`= '12' )) form member_copy1 )
from member_copy1
GROUP BY `Ssurname`
Order by Rows_Status_11 Desc
sql above is not work please help to correct it
may be (select count(*) as tol where ( (`status`= '11' ) or (`status`= '12' )) form member_copy1 ) is not correct
, SUM(CASE WHEN ((`status`= '11' ) or (`status`= '12' ) ) THEN 1 ELSE 0 END) as Rows_Status_11
, SUM(CASE WHEN ((`status`!= '11' ) AND(`status`!= '12' ) ) THEN 1 ELSE 0 END) as Rows_Status_not_11,(select
from member_copy1
GROUP BY `Ssurname`
Order by Rows_Status_11 Desc
sql above is not work please help to correct it
may be (select count(*) as tol where ( (`status`= '11' ) or (`status`= '12' )) form member_copy1 ) is not correct
SOLUTION
membership
Create a free account to see this answer
Signing up is free and takes 30 seconds. No credit card required.
ASKER CERTIFIED SOLUTION
membership
Create a free account to see this answer
Signing up is free and takes 30 seconds. No credit card required.
SOLUTION
membership
Create a free account to see this answer
Signing up is free and takes 30 seconds. No credit card required.