select id,name
from friends
order by id=5 desc
(given you don’t care about order of the rest, otherwise, e.g. rest by id asc)
select id,name
from friends
order by id=5 desc, id asc
More Related Contents:
- Which DB technology is sued to solve the following search issue? [closed]
- MySQL pivot row into dynamic number of columns
- Delete all Duplicate Rows except for One in MySQL? [duplicate]
- Count the number of occurrences of a string in a VARCHAR field?
- What’s faster, SELECT DISTINCT or GROUP BY in MySQL?
- MySQL – Operand should contain 1 column(s)
- How to get the difference in years from two different dates?
- Restore table structure from frm and ibd files
- mysql pivot/crosstab query
- MySQL: Split comma separated list into multiple rows
- Most efficient way to get table row count
- UNION query with codeigniter’s active record pattern
- Mysql Convert Column to row (Pivot table )
- Merge two tables in one SQL query and make the date values unique
- Remove Primary Key in MySQL
- Get most recent row for given ID
- Is merge statement available in MySQL
- Mysql covering vs composite vs column index
- MYSQL syntax not evaluating not equal to in presence of NULL
- Mysql insert random datetime in a given datetime range
- Greatest value of multiple columns with column name?
- MySQL: LAST_INSERT_ID() returns 0
- MySQL UPDATE syntax with multiple tables using WHERE clause
- INSERT INTO or UPDATE with two conditions
- Storing IPv6 Addresses in MySQL
- Insert/ Update random date in MySQL
- Replace null with 0 in MySQL
- Get total hours worked in a day mysql
- Update multiple rows with multiple ‘where’ clauses for each individual row
- ORDER BY alphabet first then follow by number