我有一个查询工作find_in_set这样工作
$groupid = 245;
$formsidlist = '52,57,103,104,105,107,109,110';
$query = "SELECT * FROM #__immi_visaformfields WHERE
FIND_IN_SET('$groupid','field_duplicate') AND published='1' AND
FIND_IN_SET(formid,'$formsidlist') ORDER BY id";
现在我将formidlist更改为
$formsidlist = '52-1,57-2,103-1,104-1,105-2,107-1,109-1,110-1';
从52-1开始,应该将52与formid列进行比较,并将1与formversionid列进行比较。
我该如何实现?
最佳答案
将formid与'-'和formversionid连接:
FIND_IN_SET(concat(formid, '-', formversionid), '$formsidlist') ORDER BY id";
关于mysql - mysql find_in_set匹配2列,我们在Stack Overflow上找到一个类似的问题:https://stackoverflow.com/questions/44235681/