SELECT COUNT(*) FROM messages m INNER JOIN channel_members cm ON m.channel_id = cm.channel_id WHERE cm.user_id = {user_id} AND m.user_id != {user_id} AND (cm.last_read_at IS NULL OR m.created_at > cm.last_read_at)