我有一个这样的MySQL查询-
SELECT u.id, u.email from users u.email IN ('u2.gmail.com', 'u3@gmail.com', 'u1@gmail.com');
输出是这样的-
| 5 | u1@gmail.com |
| 2 | u2@gmail.com |
| 1 | u3@gmail.com |
The output order is done based on the email address ascending. But I want to keep the order from the IN
clause, ie -
| 2 | u2@gmail.com |
| 1 | u3@gmail.com |
| 5 | u1@gmail.com |
I've already tried with ORDER BY FIELD()
but it's not working. Can anyone help me how can I get this?
提前致谢