[英]MYSQL pass stored procedure variable IN clause
How can I query comma separated dynamic ids in where
clause IN
function?如何在where
子句IN
function 中查询逗号分隔的动态 ID?
SET @status_ids = '1,3'; SET @status_ids = '1,3';
SELECT story_title, description FROM tbl_story WHERE story_status_id IN (@status_ids);
Try the FIND_IN_SET function.试试FIND_IN_SET function。
SET @status_ids = '1,3';
SELECT story_title, description FROM tbl_story WHERE FIND_IN_SET(story_status_id, @status_ids) > 0;
声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.