Home > Database > Mysql Tutorial > body text

Mysql:把指定数据行排在前面_MySQL

WBOY
Release: 2016-06-01 13:08:52
Original
1445 people have browsed it

如果只是一条数据行,可以这样:

SELECT * FROM user ORDER BY user_id<>7,score DESC;
Copy after login

主要是“user_id<>7”,就会把用户id为7的排在前面。

如果是多条数据行:

SELECT * FROM user ORDER BY user_id NOT IN(7,8,9),score DESC;
Copy after login

 

source:php.cn
Statement of this Website
The content of this article is voluntarily contributed by netizens, and the copyright belongs to the original author. This site does not assume corresponding legal responsibility. If you find any content suspected of plagiarism or infringement, please contact admin@php.cn
Popular Tutorials
More>
Latest Downloads
More>
Web Effects
Website Source Code
Website Materials
Front End Template