mysql> SELECT COUNT(*) AS total FROM xf_thread LEFT JOIN xf_post ON (xf_post.post_id = xf_thread.first_post_id) WHERE xf_thread.discussion_state = 'deleted' AND xf_post.message_state = 'deleted';
+-------+
| total |
+-------+
| 223 |
+-------+
1 row in set (0.02 sec)