SELECT DATE(`date`),
COUNT(`page`) AS indexCount,
SUM(`page` = 'index.php') as idx_count,
SUM(`page` <> 'index.php') as not_idx_count
FROM `tracking`
WHERE `date` BETWEEN DATE_ADD(NOW(),INTERVAL -30 DAY) AND NOW()
GROUP BY DATE(`date`)