Currently I am doing a query with three subqueries,
all requests are in the same table,
all requests are different places where
I was thinking of making a group, but that would destroy SUM ()
here is the request
SELECT SUM(club) AS club,
(SELECT COUNT(id) FROM action_6_members WHERE SUBSTR(CODE, 1, 1) = '9') AS 5pts,
(SELECT COUNT(id) FROM action_6_members WHERE SUBSTR(CODE, 1, 1) = 'A') AS 10pts,
(SELECT COUNT(id) FROM action_6_members WHERE SUBSTR(CODE, 1, 1) NOT IN('9', 'A')) AS General
FROM action_6_members;
here is an explanation
id select_type table type rows Extra
1 PRIMARY action_6_members ALL 1471
4 SUBQUERY action_6_members ALL 1471 Using where
3 SUBQUERY action_6_members ALL 1471 Using where
2 SUBQUERY action_6_members ALL 1471 Using where
source
share