Query returning same sums - oracle sql -
Wonders that any SQL query can put any light on;
I have this query created; Reservation, ticket, TICKET_TYPE, CINEMA, execution in the form of SELECT SUM (TICKET_TYPE.PRICE), where TICKET_TYPE.TICKET_TYPE_ID = TICKET.TICKET_TYPE_ID and from, TOTALCINEMASALES, CINEMA.LOCATION, PERFORMANCE.PERFORMANCE_DATE 'Skipton' between reservation TICKET.RESERVATION_ID = RESERVATION.RESERVATION_ID and RESERVATION.PERFORMANCE_ID = PERFORMANCE.PERFORMANCE_ID and CINEMA.LOCATION = TO_DATE ('01 / 03/2009 ',' day / month / year ') and PERFORMANCE.PERFORMANCE_DATE and TO_DATE ('07/04/2009', 'DD / MM / YAY') Group Group by CINAMA, Performance. PERFORMANCE_DATE Overall Order;
Whenever I run it, it gives Sam's set of sums to each line for totalcinemasales, but I know that ticket sales are different levels of sit in database etc. It does this for me, I change every person, any indication that I can improve it?
You forgot with joining the cinema, perhaps with performance
Estimates.
and CINEMA.CINEMA_ID = PERFORMANCE.CINEMA_ID You can use ANSI, when you get used to it, it's really easy to read Is:
Select SUM (TICKET_TYPE.PRICE) from TOTALCINEMASALES, CINEMA.LOCATION, TORET.RESERVATION_ID = RESERVATION.RESERVATION_ID in inner ticket as in PERFORMANCE.PERFORMANCE_DATE for ticket induction. Join TICKET_TYPE on TICKET_TYPE.TICKET_TYPE_ID = TICKET.TICKET_TYPE_ID RESERVATION.PERFORMANCE_ID = PERFORMANCE.PERFORMANCE_ID to join the inside of the show on the cinema / * Where in CINEMA.CINEMA_ID = PERFORMANCE.CINEMA_ID CINEMA.LOCATION = 'Skipton' and PERFORMANCE.PERFORMANCE_DATE to TO_DATE ('01 / 03/2009 ',' day / month / year ') and TO_DATE ('07 / 04) / 2009 ',' DD / MM / YAY ') Group Group, Performance by CINAMA. PERFORMANCE_DATE Overall Order;
Comments
Post a Comment