0
我在選擇和分組下表時遇到問題。 表 「Igralci」 看起來是這樣的:如何對sql select語句進行排序,以便正確顯示排行榜?
----------------------------------------------
|ID|U_ID|st_tock|st_srecanj|st_nizov|st_gemov|
----------------------------------------------
|19| 17 | 6 | 3 | 6 | 72 |
----------------------------------------------
|11| 19 | 12 | 6 | 24 | 144 |
----------------------------------------------
|15| 18 | 12 | 6 | 26 | 72 |
----------------------------------------------
我想編號的下列方式排序:
1. First looks at st_tock (if st_tock is same) ->
2. Looks at st_srecanj (if st_srecanj is same) ->
3. Looks at st_nizov (if st_nizov is same) ->
4. Looks at st_gemov
我想:
Select * from Igralci
group by id, st_tock, st_srecanj, st_nizov, st_gemov
order by st_tock, st_srecanj, st_nizov, st_gemov;
想要的顯示會(ID):
- 15 (同st_tock和st_srecanj爲11,但他有更多的st_nizov)
您先生是救命恩人!上帝祝福你。 – RageMasterGaming