sql staement for my ql to count

SELECT COUNT( * ) as Rows , `Ssurname` from member_copy1 where `status`= '11' GROUP BY `Ssurname` Order by Rows Desc

sql above is work but i want the result that  `status`!= '11' to show to compare too what can I do
Who is Participating?
Guy Hengel [angelIII / a3]Connect With a Mentor Billing EngineerCommented:
here we go:
SELECT `Ssurname` 
, SUM(CASE WHEN `status`= '11' THEN 1 ELSE 0 END) as Rows_Status_11
, SUM(CASE WHEN `status`= '11' THEN 0 ELSE 1 END) as Rows_Status_not_11
from member_copy1 
GROUP BY `Ssurname` 
Order by Rows_Status_11 Desc

Open in new window

Question has a verified solution.

Are you are experiencing a similar issue? Get a personalized answer when you ask a related question.

Have a better answer? Share it in a comment.

All Courses

From novice to tech pro — start learning today.