次のようなテーブル構造があります。
ClassId
ClassDescription
私のテーブルのデータは次のようになります。
ClassId ClassDesc
4 ---
4 ---
4 ---
4
4
2
2
2
今私がやろうとしているのは、classId
個々のclassId
意味に基づいてのカウントを取得することです。例として、上記の表は、classId = 4 のすべてに対して 5 のカウントを返し、classId = 2 に対して 3 のカウントを返します。
したがって、私のSqlステートメントはそれらを個別にカウントし、Order BY DESC On Count of ClassId
4は5に
数えます 2は3に数えます
最終的な出力は次のようになります。
ClassId ClassDesc
4 ----
2 ----