J'ai cette requêteTrier par nom et par titre le plus populaire - Oracle
select movie_name, user_name
from movie natural join movie_queue natural join users
group by (movie_name, user_name)
order by movie_name;
Cela tombe une liste semblable à celui ci-dessous:
MOVIE_NAME USER_NAME
------------------------------------------------------- ------------------------
E.T. the Extra-Terrestrial Cris
E.T. the Extra-Terrestrial Elizabeth
E.T. the Extra-Terrestrial John
E.T. the Extra-Terrestrial Mary
E.T. the Extra-Terrestrial Peter
Indiana Jones and the Kingdom of the Crystal Skull Elizabeth
Indiana Jones and the Kingdom of the Crystal Skull John
Indiana Jones and the Kingdom of the Crystal Skull Mary
Jurassic Park Elizabeth
Jurassic Park John
Jurassic Park Mary
Jurassic Park Peter
Signs Elizabeth
The Sixth Sense Mary
Unbreakable John
Unbreakable Mary
Unbreakable Peter
War of the Worlds Elizabeth
War of the Worlds John
War of the Worlds Mary
War of the Worlds Peter
La question est de savoir comment dois-je trier par popularité de ligne et par nom de film?
Je commande actuellement la liste par movie_name, mais je veux également les commander à partir du film le plus populaire au film moins populaire.
Le résultat souhaité:
En conséquence, « ET l'extra-terrestre » lignes doivent apparaître d'abord parce qu'il apparaît plusieurs fois sur la table, et « Sixième sens » devrait apparaître en dernier, juste après "Signes". Parce que les deux derniers films apparaissent seulement 1 fois, mais S passe avant T.
J'ai essayé d'ajouter ceci: par compte (nom de film), nom de film;
Mais je n'obtiens toujours pas le résultat que je veux. devrait être organisé comme celui-ci
Au cinéma de fin Voici comment je veux qu'ils soient organisés: De plus populaire à moins populaire, et par ordre alphabétique
MOVIE_NAME USER_NAME
------------------------------------------------------- ------------------------
E.T. the Extra-Terrestrial Cris
E.T. the Extra-Terrestrial Elizabeth
E.T. the Extra-Terrestrial John
E.T. the Extra-Terrestrial Mary
E.T. the Extra-Terrestrial Peter
Jurassic Park Elizabeth
Jurassic Park John
Jurassic Park Mary
Jurassic Park Peter
War of the Worlds Elizabeth
War of the Worlds John
War of the Worlds Mary
War of the Worlds Peter
Indiana Jones and the Kingdom of the Crystal Skull Elizabeth
Indiana Jones and the Kingdom of the Crystal Skull John
Indiana Jones and the Kingdom of the Crystal Skull Mary
Unbreakable John
Unbreakable Mary
Unbreakable Peter
Signs Elizabeth
The Sixth Sense Mary
Merci à l'avance
@Burhan, merci !, Je comprends que je peux avoir plusieurs colonnes, j'ai essayé count (movie_name) comme une deuxième colonne mais je n'ai toujours pas le résultat que je veux. J'en ai besoin pour mettre en premier les films qui sont les plus populaires (la popularité est basée sur avoir plus de lignes). – Cristy