mysql实现查询两个集合是否有完全包含的关系,其中两个集合是根据逗号分隔的字符串。
```sql
-- 被包含的字符串
SET @inStr:= '7654,7698,7782,7788';
-- 长的字符串
SET @outStr:= '7654,7698,7782,7788,7789,7790,7791';
SELECT
@f AS reuslt
FROM
(
SELECT
-- t0.num, t1.nums,
@f := (@f AND (FIND_IN_SET(t0.num, t1.nums))) AS resFlag
FROM
(
SELECT
SUBSTRING_INDEX(
SUBSTRING_INDEX(@inStr, ',', help_topic_id + 1), ',', - 1
) AS num
FROM
mysql.help_topic
WHERE
help_topic_id < LENGTH(@inStr) - LENGTH(
REPLACE (@inStr, ',', '')
) + 1
) t0
JOIN (
SELECT
@outStr AS nums
) t1
WHERE
@f := 1
) t2
LIMIT 1