SELECT
*
from (
(
-- 文章博客
SELECT * from
(
select a.id,substring_index(substring_index(a.tag,',',b.help_topic_id+1),',',-1) as tag, a.create_time as createTime
from
content_blog_article a
join
mysql.help_topic b
on b.help_topic_id < (length(a.tag) - length(replace(a.tag,',',''))+1)
) as result
where tag in (select tag from content_tag where type = "WHDK")
)
UNION
(
-- 相册博客
SELECT * from
(
select a.id,substring_index(substring_index(a.tag,',',b.help_topic_id+1),',',-1) as tag, a.create_time as createTime
from
content_blog_note a
join
mysql.help_topic b
on b.help_topic_id < (length(a.tag) - length(replace(a.tag,',',''))+1)
) as result
where tag in (select tag from content_tag where type = "WHDK")
)
) as result
order by createTime desc