SELECT COUNT(*) FROM emails e INNER JOIN email_folder_map efm ON e.id = efm.email_id INNER JOIN email_folders f ON efm.folder_id = f.id WHERE e.user_id = {user_id} AND e.is_read = 0 AND f.folder_type = 'inbox'