Ну, во первых, если посмотреть сюда:
SELECT COUNT(*) AS n1 FROM `z` WHERE x=1
SELECT COUNT(*) AS n2 FROM `z` WHERE a=0 AND x=1
SELECT COUNT(*) AS n3 FROM `z` WHERE a=1 AND x=1
SELECT COUNT(*) AS n4 FROM `z` WHERE a>1 AND x=1
то н4 можно получить и без запроса: н4=н1-н2-н3
SELECT COUNT(*) AS n1 FROM `z` WHERE x=1
SELECT COUNT(*) AS n2 FROM `z` WHERE a=0 AND x=1
SELECT COUNT(*) AS n3 FROM `z` WHERE a=1 AND x=1
SELECT COUNT(*) AS n4 FROM `z` WHERE a>1 AND x=1
то н4 можно получить и без запроса: н4=н1-н2-н3