ユーザーがコメントできるブログがあるとします。コメントがスパムの場合、人々はそれを削除投票できます。その場合、次のテーブルに行が挿入されます。
SPAM_REPORTS
comment_id - ip
テーブルは で一意comment_id, ip
です。
ここで、レポートの最大数で並べ替えられた comment_id を出力したいと考えています。
仮定しSPAM_REPORTS
ます:
comment_id ip
6 888.xxx.xxx.xxx
5 111.xxx.xxx.xxx
5 222.xxx.xxx.xxx
6 444.xxx.xxx.xxx
1 333.xxx.xxx.xxx
5 555.xxx.xxx.xxx
出力を次のようにしたい:
comment_id count
5 3
6 2
1 1