Depending on your version of MySql, the PARTITION keyword does not exist until MySQL 5.6.2 . You will use MySQL 5.5 or even 5.1, but not 5.6. In case you are using MySQL 5.1 , then you can do a workaround as shown below
SELECT partition, count(ID) FROM ( SELECT ID, case when condition then p1 when condition then p2 ..... end as partition FROM table ) s1 GROUP BY partition
Note. . The above solution is just a workaround to get the desired result.
You can also try this query to calculate the total number of rows for your section.
SELECT table_rows as 'count(*)' FROM information_schema.partitions WHERE table_schema = schema() and table_name ='employees' and partition_name = 'p0';
Note: you can change table_schema = schema() to table_schema = 'yourschema'
Ravi
source share