全站年SVIP
全站1000+试题无限查看
SELECT * FROM `product` WHERE `id` IN (1,3,6,7,9) ORDER BY FIELD(`id`, 7,1,3,6,9)
字段按照指定 ID 顺序进行排序
SELECT * FROM `product` WHERE `id` IN (1,3,6,7,9) ORDER BY FIELD(`id`, 7,1,3,6,9)
FIELD() 函数传入的 ID 必须是有效的,否则排序失效