Je me demande si quelqu'un peut m'aider à comprendre comment résumer la colonne d'une seule colonne, c'est-à-dire une liste de coûts en un seul coût total.oracle - somme sur une sous-requête?
J'ai regardé ceci, et je pense que je suis sur les bonnes lignes dans undertsanding que j'ai besoin de résumer la requête, la traiter comme une sous-requête. Cependant je n'ai pas beaucoup de chance - ai-je besoin de donner un alias à la sous-requête, ou est-ce un cas direct d'encapsulation de la requête dans une somme?
Voici la requête de travail que je veux résumer, toutes mes tentatives de somme à exclure pour plus de clarté!
SELECT TICKET_TYPE.PRICE AS TOTALSALES, RESERVATION.RESERVATION_ID,
CINEMA.LOCATION, PERFORMANCE.PERFORMANCE_DATE
FROM RESERVATION, TICKET, TICKET_TYPE, CINEMA, PERFORMANCE
WHERE TICKET_TYPE.TICKET_TYPE_ID = TICKET.TICKET_TYPE_ID
AND TICKET.RESERVATION_ID = RESERVATION.RESERVATION_ID
AND RESERVATION.PERFORMANCE_ID = PERFORMANCE.PERFORMANCE_ID
AND CINEMA.LOCATION = 'sometown'
AND PERFORMANCE.PERFORMANCE_DATE = to_date('01/03/2009','DD/MM/yyyy');
certaines des données ...
TOTALSALES RESERVATION_ID LOCATION PERFORMANCE_DATE
2.8 1 sometown 01-MAR-09
3.5 2 sometown 01-MAR-09
2.8 3 sometown 01-MAR-09
2.8 3 sometown 01-MAR-09
2.8 3 sometown 01-MAR-09
2 4 sometown 01-MAR-09
2.8 5 sometown 01-MAR-09
Merci!
Actuellement, il n'y a rien liant CINEMA à PERFORMANCE Tableaux, pas de relations PK/FK, ce qui causerait quelques problèmes ... – curtisk