SELECT
t.id,
t.activeName,
t.courseTitle,
t.activeId,
t.baseId
FROM
(
SELECT
a.id,
a.active_name AS activeName,
a.base_id AS baseId,
t2.active_id AS activeId,
t2.course_id AS courseId,
t3.title AS courseTitle,
substring_index( substring_index( t3.course_type, ',', b.help_topic_id + 1 ), ',',- 1 ) AS splitValue
FROM
base_active a
LEFT JOIN base_plan_active_course t2 ON t2.active_id = a.id
AND t2.deleted = 0
LEFT JOIN base_course t3 ON t3.id = t2.course_id
AND t3.deleted = 0
JOIN mysql.help_topic b ON b.help_topic_id <= ( length( t3.course_type ) - length( REPLACE ( t3.course_type, ",", "" ) ) + 1 )
WHERE
a.deleted = 0
AND a.is_start = "0"
AND a.base_id = '8a3916b3d6906ccfa2820f29bf71dccd'
) AS t
WHERE
FIND_IN_SET( t.splitValue, 'f' )
GROUP BY
t.id
sql实现数据拆分 模糊查询
最新推荐文章于 2022-03-28 21:55:54 发布