select r.id,
r.pid,
r.article_id,
r.content,
r.user_id,
r.user_name,
r.create_time,
r2.id bellow_id,
r2.content bellow_content,
null likes_num,
'sonreply' op_type
from cms_article_comment r
left join cms_article_comment r2 on r.pid = r2.id
where r.pid is not null
and r.pid != ''
union
select r.id, r.pid, r.article_id, r.content,
r.user_id, r.user_name, r.create_time,
p.id bellow_id, p.title bellow_content,
(select count (*) from cms_comment_like where comment_id=r.id) likes_num,
'articlereply' op_type
from cms_article_comment r
left join cms_article p
on r.article_id=p.id
where r.pid is null or r.pid = ''