先按時間排序,再按姓名排序 sql語句

2021-08-28 04:58:43 字數 499 閱讀 4549

將字段依次寫在order by 後面即可 , 中間用逗號隔開

select * from 表 order by time , name

select * from 表 order by time asc , name asc

select * from 表 order by time desc , name desc

select * from 表 order by time asc , name desc

select * from 表 order by time desc , name asc

(注: asc 表示公升序 , desc表示降序 , 未明確寫明排序方式時預設是公升序 )

與之類似的語法是 group by , 按多個字段分組時 , 也是依次將多個欄位寫在group by 的後面 , 並用逗號隔開 , 範例如下:

select time , name , sum(*) from 表 group by time , name

先按時間排序,再按姓名排序 sql語句

將字段依次寫在order by 後面即可 中間用逗號隔開 select from 表 order by time name select from 表 order by time asc name asc select from 表 order by time desc name desc sele...

ls 按時間排序

在linux系統中,使用ls命令按時間排序檔案,其實很簡單,如下 ls altr 即可按時間排序當前目錄下的檔案。附,ls命令的引數中文詳解 a 列出目錄下的所有檔案,包括以 開頭的隱含檔案。b 把檔名中不可輸出的字元用反斜槓加字元編號 就象在c語言裡一樣 的形式列出。c 輸出檔案的 i 節點的修改...

js 資料按時間排序

運用了sort 方法進行排序 說明 如果呼叫該方法時沒有使用引數,將按字母順序對陣列中的元素進行排序,說得更精確點,是按照字元編碼的順序進行排序。要實現這一點,首先應把陣列的元素都轉換成字串 如有必要 以便進行比較。如果想按照其他標準進行排序,就需要提供比較函式,該函式要比較兩個值,然後返回乙個用於...