题目地址
https://leetcode.cn/problems/finding-the-topic-of-each-post/description/
代码
with t1 as(
select p.*, k.*
from Posts p
left join Keywords k
on LOCATE(LOWER(CONCAT(' ', word, ' ')), LOWER(CONCAT(' ', content, ' '))) >0
)
select post_id,
ifnull(group_concat(distinct topic_id order by topic_id asc separator "," ),"Ambiguous!") as topic
from t1
group by post_id
order by post_id asc
# select * from t1
标签:LOCATE,group,topic,select,LeetCode2199,post,id,concat
From: https://www.cnblogs.com/yhm138/p/17642333.html