Get number of posts in each category since last visit

use wpdb query instead:
“SELECT DISTINCT wposts.*
FROM $wpdb->posts wposts
LEFT JOIN $wpdb->postmeta wpostmeta ON wposts.ID = wpostmeta.post_id
LEFT JOIN $wpdb->term_relationships ON (wposts.ID = $wpdb->term_relationships.object_id)
LEFT JOIN $wpdb->term_taxonomy ON ($wpdb->term_relationships.term_taxonomy_id = $wpdb->term_taxonomy.term_taxonomy_id)
WHERE post_date >= {$lastvisit}
AND $wpdb->term_taxonomy.taxonomy = ‘category’
“;

I did not test this but should work. I also suggest you to use prepared statements