Hi there, I need your appreciated help.
This is my table mysql:
ID A P
1 S
2 S
3 S S
4 S S
And this is my query:
SELECT
SUM(IF(A='S', 1, 0)) 'tot_A'
, SUM(IF(P='S', 1, 0)) 'tot_P'
FROM tbl_x;
Output
tot_A tot_P
3 3
But when I have this records (A
and P
= S)
ID A P
3 S S
4 S S
I need SUM only field P
value:
tot_A tot_P
1 3
Can you help me?
Thanks in advance.