FIND IN SET函数:修订间差异

来自维基鲸
(创建页面,内容为“category_ids字段:2,4,8,13,25 === 原生SQL: === <pre> select * from table where FIND_IN_SET('13',category_ids) </pre> ===ThinkPHP === <pre> $category_ids = 13; $where[] = ['exp', Db::raw("FIND_IN_SET($category_ids,category_ids)")]; </pre>”)
 
无编辑摘要
 
(未显示同一用户的1个中间版本)
第9行: 第9行:
$where[] = ['exp', Db::raw("FIND_IN_SET($category_ids,category_ids)")];
$where[] = ['exp', Db::raw("FIND_IN_SET($category_ids,category_ids)")];
</pre>
</pre>
[[category:thinkphp]]
[[category:mysql]]

2024年4月24日 (三) 16:41的最新版本

category_ids字段:2,4,8,13,25

原生SQL:

select * from table where FIND_IN_SET('13',category_ids)
 

ThinkPHP

$category_ids = 13;
$where[] = ['exp', Db::raw("FIND_IN_SET($category_ids,category_ids)")];