To create a request for each COUNT (field_x), I think it is somehow not rational and cumbersome. I tried such a construction, give an example:
SELECT COUNT(`field_1`), COUNT(`field_2`), COUNT(`field_3`) FROM (SELECT `field_1`, `field_2`, `field_3`, `field_4` FROM `table_name` WHERE `date_field`="01.01.2017" AND (`field_1`="data_1" OR `field_1`="data_2" OR `field_1`="data_3")) sub WHERE `field_1`="data_1" AND `field_2`="data_2" It works, but the counter gives the amount from the last field field_2 = "data_2":
COUNT(`field_1`) | COUNT(`field_2`) ----------------------------------- 1 | 1 in fact should be (I would like to get such a table):
COUNT(`field_1`) | COUNT(`field_2`) ----------------------------------- 3 | 1 Is it possible to implement this in one request? I have 7 counters in the working code.
select sum(`field_1`="data_1"), sum(`field_2`="data_2") from ...- PetSerAl