Вы должны сгруппировать подзапрос variuos в один с разным количеством и использовать объединение для объединения данных
подзапрос должен быть:
select thread_id
count(when isnull(is_approved,'N')='N' then 1 end) as replies,
count(when isnull(new_post,'Y')='Y' then 1 end) as NewPost,
count(when isnull(is_approved,'N')='N' then 1 end) as NotClear
from tblmessages
where sort_level>1
group by thread_id
В то время как последнийследующий
select thread_id as topic_id,title as topic,
sort_level,sort_index , B.replies, B.NewPost, B.NotClear
from tblMessages a
join
(select thread_id
count(when isnull(is_approved,'N')='N' then 1 end) as replies,
count(when isnull(new_post,'Y')='Y' then 1 end) as NewPost,
count(when isnull(is_approved,'N')='N' then 1 end) as NotClear
from tblmessages
where sort_level>1
group by thread_id) as B
on a.thread_id = B.thread_id
where sort_level=1 and category=@category
order by topic_id desc