SELECT category, type , count( * ) as total FROM `documents` GROUP BY category, type HAVING total < 3