Mysql查询数据返回排序
例如有这样一条语句
select uid from user where uid = 70 or uid =68 or uid = 69;
mysql返回的是
68
69
70
如何让mysql返回
70
68
69
这样的结果,就是按照where的条件先后来返回.
回复内容:
例如有这样一条语句
select uid from user where uid = 70 or uid =68 or uid = 69;
mysql返回的是
68
69
70
如何让mysql返回
70
68
69
这样的结果,就是按照where的条件先后来返回.
<code>SELECT id, name FROM mytable WHERE name IN ('B', 'A', 'D', 'E', 'C') ORDER BY FIELD(name, 'B', 'A', 'D', 'E', 'C')</code>
网上随便找下就有了
select uid from user where uid in( 70 ,68 , 69) order by fine_in_set('uid','70,68,69');
<code>select uid from user where uid = 70 or uid =68 or uid = 69 order by uid desc</code>
select uid from user where uid = 70 or uid =68 or uid = 69 order by uid desc;

熱AI工具

Undresser.AI Undress
人工智慧驅動的應用程序,用於創建逼真的裸體照片

AI Clothes Remover
用於從照片中去除衣服的線上人工智慧工具。

Undress AI Tool
免費脫衣圖片

Clothoff.io
AI脫衣器

AI Hentai Generator
免費產生 AI 無盡。

熱門文章

熱工具

記事本++7.3.1
好用且免費的程式碼編輯器

SublimeText3漢化版
中文版,非常好用

禪工作室 13.0.1
強大的PHP整合開發環境

Dreamweaver CS6
視覺化網頁開發工具

SublimeText3 Mac版
神級程式碼編輯軟體(SublimeText3)

適用於 Ubuntu 和 Debian 的 PHP 8.4 安裝和升級指南

如何修復 MySQL 8.4 上的 mysql_native_password 未載入錯誤

如何設定 Visual Studio Code (VS Code) 進行 PHP 開發
