我正在尝试根据 ID 进行简单搜索
SELECT * FROM `test` AS a
WHERE a.bla != '1' AND (
a.id = 85355 OR
a.id = 85353 OR
a.id = 80090 OR
a.id = 1 OR
a.id = 300
)
LIMIT 0, 5
问题是根据我的查询未列出结果。
我希望行顺序是这样的85355, 85353, 80090, 1, 300
我尝试了以下查询,但不起作用。
SELECT * FROM `test` AS a WHERE a.bla!='1' AND (a.id=85355 OR a.id=85353 OR a.id=80090 OR a.id=1 OR a.id=300)
ORDER BY IF (FIELD(id, "85355,85353,80090,1,300"), 0, id), FIELD(id, "85355,85353,80090,1,300")
有没有办法根据我的自定义顺序对查询结果进行排序?