我有一個表,其中parent_id
和percentage_score
這是一個簡單的重複數據刪除的結果。我現在的問題是如何選擇的記錄,並安排他們這樣的:按匹配記錄百分比排序表
|id|lastname|firstname|number|parent_id|percentage_score|
--------------------------------------------------------
|1 |holmes | james |11112 | 0 |100% |
|7 |holmes | john |11112 | 1 |80% |
|8 |holmes | james |11113 | 1 |60% |
|4 |sherlock| steve |77777 | 0 |100% |
|9 |sherlock| stove |77777 | 4 |80% |
|12|ketchum | ash |00001 | 0 |100% |
我試圖通過parent_id, percentage_score
使用順序,但是這還沒有接近我想要的東西。
你爲什麼不GROUP BY的姓,然後排序percent_score? –