Use FIELD():
SELECT * FROM table WHERE id IN (5,4,3,1,6) ORDER BY FIELD(id, 5,4,3,1,6);
Related Contents:
- MySQL – SELECT WHERE field IN (subquery) – Extremely slow why?
- Insert into a MySQL table or update if exists
- How can I find all the tables in MySQL with specific column names in them?
- MySQL error: key specification without a key length
- How to remove constraints from my MySQL table?
- MySQL search and replace some text in a field
- Cannot delete or update a parent row: a foreign key constraint fails
- How to get database structure in MySQL via query
- Select records from NOW() -1 Day
- ERROR 1044 (42000): Access denied for user ”@’localhost’ to database ‘db’
- How to define a custom ORDER BY order in mySQL
- MySQL: Can’t create table (errno: 150)
- How can I suppress column header output for a single SQL statement?
- Unknown Column In Where Clause
- Having both a Created and Last Updated timestamp columns in MySQL 4.0
- mysql is not recognised as an internal or external command,operable program or batch
- What is a proper naming convention for MySQL FKs?
- Mysql order by specific ID values
- Print debugging info from stored procedure in MySQL
- MySQL – how many rows can I insert in one single INSERT statement?
- mysql SQL: specific item to be first and then to sort the rest of the items
- How can I show user’s privileges in MySQL?
- `mysql_upgrade` is failing with no real reason given
- Store the MySQL client password, or setup password less authentication
- Choosing a value for wait_timeout & interactive_timeout in MySQL config?
- Ruby on Rails 3 Can’t connect to local MySQL server through socket ‘/tmp/mysql.sock’ on OSX
- Scaling solutions for MySQL (Replication, Clustering)
- MYSQL_ROOT_PASSWORD is set but getting “Access denied for user ‘root’@’localhost’ (using password: YES)” in docker container
- How can I undo a mysql statement that I just executed?
- Illegal mix of collations (utf8mb4_unicode_ci,IMPLICIT) and (utf8mb4_general_ci,IMPLICIT) for operation ‘=’
- MySQL – Selecting a Column not in Group By
- LOAD DATA INFILE Error Code : 13
- How many databases can I create on a single Amazon RDS instance
- MySQL Update query with left join and group by
- mysql datatype for telephone number and address
- Are Users ‘User’@’%’ and ‘User’@’localhost’ not the same?
- MySQL add a NOT NULL column
- Mysql – How to update a column using another column’s value plus some strings
- How to make a primary key start from 1000?
- Working with INTERVAL and CURDATE in MySQL
- How to rename a view in MySQL?
- MySql: MyISAM vs. Inno DB! [closed]
- How to disable index in innodb
- String to timestamp in MySQL
- MySQL : Multiple row as comma separated single row
- mysql “Where not in” using two columns
- how to compute similarity between two strings in MYSQL
- MySQL 8 create new user with password not working
- Can’t create test file lower test start server mysql
- MySQL alias for SELECT * columns