且构网

分享程序员开发的那些事...
且构网 - 分享程序员编程开发的那些事

mysql将数据传递到

更新时间:2023-12-03 16:05:10

可以使用find_in_set函数吗?

SELECT x FROM tblname1 t1
inner join tblname2 t2 on find_in_set (t1.id, REPLACE(t2.content,'|',',')) > 0
where t2.dataid = 'y';

find_in_set函数返回第二个参数中第一个参数的位置.如果结果> 0,则找到第一个参数.

The find_in_set function returns the position of the first argument within the second argument. If the result is >0, then the first argument has been found.

请参见 http://dev.mysql.com/doc/refman/5.7/zh-CN/string-functions.html#function_find-in-set