SELECT
*
FROM
sk_tbl_article_info stai
LEFT JOIN
sk_tbl_gz_user stgu
ON FIND_IN_SET(stai.article_id,stgu.collection)
WHERE
1 = 1
AND stgu.openid = "o8kyx0fOtKzt4T0mJk6RRyy9jifE"
in ('1','2')
*
FROM
sk_tbl_article_info stai
LEFT JOIN
sk_tbl_gz_user stgu
ON FIND_IN_SET(stai.article_id,stgu.collection)
WHERE
1 = 1
AND stgu.openid = "o8kyx0fOtKzt4T0mJk6RRyy9jifE"
in ('1','2')
FIND_IN_SET('1,2')
用户有个收藏字段,收藏一篇文章就往这字段追加文章的id以逗号分隔,
FIND_IN_SET(str,strlist)
如果字符串str是在的strlist组成的N子串的字符串列表,返回值的范围为1到N。
SQL> SELECT FIND_IN_SET('b','a,b,c,d');
+---------------------------------------------------------+
| SELECT FIND_IN_SET('b','a,b,c,d') |
+---------------------------------------------------------+
| 2 |
+---------------------------------------------------------+
1 row in set (0.00 sec)