Keep the the same order as input data when using `WHERE fieldName IN(fieldVal1, fieldVal2)`

Don't waste time; here's the sample code with the Oracle database.

SELECT * FROM SampleTable WHERE sample_field in (7,3,4,6) ORDER BY INSTR(',7,3,4,6,',  ',' || sample_field || ',');

Comments

  1. Markdown is allowed. HTML tags allowed: <strong>, <em>, <blockquote>, <code>, <pre>, <a>.