SELECT
t.task_name,
t.task_id,
t.common_ids,
t.task_description,
t.task_type,
t.task_state,
t.task_start_time,
t.task_end_time,
bac.title_name,
bac.archive_num
FROM
task t
LEFT JOIN biz_archive_common bac ON FIND_IN_SET( bac.id, t.common_ids )
结果:
第二种:先对字符串进行截取:
select
substring_index(substring_index(task.common_ids,',',mysql.help_topic.help_topic_id+1),',',-1) as num,task_id
from
task
join
mysql.help_topic
on
mysql.help_topic.help_topic_id < LENGTH(task.common_ids)-LENGTH(replace(task.common_ids,',','')+1)