我想在 MeekroDB 中编写这样的查询:
SELECT * FROM `tablename` WHERE `id` IN (3,1,2) ORDER BY FIELD (`id`,3,1,2)
我希望它在 meekro 中像这样工作:
$possible_ids = array(1,2,3);
DB::query('SELECT * FROM `tablename` WHERE `id` IN %ld0 ORDER BY FIELD (`id`,%ld0)', $possible_ids);
但它得到了这个:
SELECT * FROM `tablename` WHERE `id` IN (3,1,2) ORDER BY FIELD (`id`,(3,1,2))
有什么办法可以避免这个括号吗?