SELECT ct.`id`, (SELECT count(`id`) FROM dle_post ps WHERE ps.category regexp '[[:<:]]ct.`id`[[:>:]]' && approve = '1') as allnews_ FROM dle_category ct
select
ct.id,
count(1) as allnews_
from dle_category ct
left join dle_post ps on ps.id = ct.id
where true
and ps.approve = '1'
group by ct.id