Find centralized, trusted content and collaborate around the technologies you use most.
Teams
Q&A for work
Connect and share knowledge within a single location that is structured and easy to search.
画像のリストを含むテーブルがあり、それらを人気のある画像シーケンスに並べ替えたいと考えています。以下に表を示します。人気のある画像を並べ替えるために、「ターゲット列」を作成したいと思います。
SQL コードは次のとおりです。
SELECT imageID FROM `ratings` WHERE rating > 3 ORDER BY imageID DESC
ご協力いただきありがとうございます。
これを試して、count と group by を使用すると、繰り返される ImageID がカウントされます。
SELECT count(*) as ct, imageID FROM `ratings` WHERE rating > 3 GROUP BY imageID ORDER BY ct