Pode-se utilizar a função FIELD
:
FIELD(str,str1,str2,str3,...)
Retorna o índice (posição) de str
na str1, str2, str3,... lista. Retorna 0 se str
não for encontrada.
Exemplo:
SELECT * FROM produtos WHERE id IN (1, 2, 3, 4) ORDER BY FIELD(id, 4, 2, 1, 3);
Ver demonstração
O teu comando SQL fica assim:
SELECT * FROM produtos
WHERE id IN
(144,140,134,133,128,129,141,143,149,150,147,146,126,142,125,99,100,92,91,90,108,109,123,124,122,121,110,89)
ORDER BY FIELD
(id, 144,140,134,133,128,129,141,143,149,150,147,146,126,142,125,99,100,92,91,90,108,109,123,124,122,121,110,89);
Field
:SELECT * FROM produtos WHERE id in(144,140,134,133,128,129,141,143,149,150,147,146,126,142,125,99,100,92,91,90,108,109,123,124,122,121,110,89) ORDER BY FIELD(id, 144,140,134,133,128,129,141,143,149,150,147,146,126,142,125,99,100,92,91,90,108,109,123,124,122,121,110,89);