I need a syntax in sql which returns a result in the same order as given in the IN() field.
The problem is that the primary key consists of two keys.
So the following does not apply:
SELECT * FROM table where id IN (4,5,6) ORDER BY FIELD (id,4,5,6);
my table:
primary(column 1+2) column 3 column 4 cloumn 5......
hash | num | | |
Pseudo code for understanding would look like this:
SELECT * FROM table WHERE (hash,num) IN (["fjdigjhu",5],["fgfjhgaa",2],...) ORDER BY FIELD ([hash,num],["fjdigjhu",5],["fgfjhgaa",2],...);
question from:
https://stackoverflow.com/questions/65844269/sql-mariadb-select-with-in-over-mutiple-columns-in-the-same-order 与恶龙缠斗过久,自身亦成为恶龙;凝视深渊过久,深渊将回以凝视…