Show first selected row Mysql

user3393795

For example:

id 1,2,3,4,5,6,7,8,9,10

I want to show first id = 7 and after 10,9,8,6,5,4,3,2,1 . How to write this code with php ? Please help me (Sorry for bad English)

Gordon Linoff

MySQL has a convenience where boolean expressions are treated as integers, with "1" for true and "0" for false. A fast way to write this is:

order by (id = 7) desc, id desc

In other databases, you need to use case or similar logic.

Collected from the Internet

Please contact [email protected] to delete if infringement.

edited at
0

Comments

0 comments
Login to comment

Related