Jump to content


Many levels in a self-join

  • Please log in to reply
No replies to this topic

#1 davidb

  • New Members
  • Pip
  • Newbie
  • 1 posts
  • LocationAthens, Greece

Posted 26 December 2003 - 11:01 AM

Hi!! I\'m currently building a cinema seat booking system via WAP and I would like some help on the databese administration.
The three tables I use for reservations are the following:
Movies_Projection: Movie_Projection_ID(Primary Key), Movie_ID, Cinema_ID, Movie_Time, Movie_Date
This table is used to produce the Movie_Projection_ID for a certain movie, which is used to filter the table Orders and select the orders for this Movie_Projection_ID. The table Orders is the following:
Orders: Ticket_ID(Primary Key), Movie_Projection_ID, Cinema_Configuration_ID, Price_ID, VAT_ID, Cinema_Seat_State, Customer_ID, Order_Time, Order_Date.
After the filtering I can get all the Cinema_Configuration_IDs which are booked and use them to filter the table Cinema_Configuration which is already filled with all the cinema seats and is the following:
Cinema_Configuration: Cinema_Configuration_ID(Primary Key), Cinema_ID, Cinema_Row_Number, Cinema_Row_Alphabetic, Cinema_Seat_Number, Cinema_Sector. So I can get all the empty seats in a certain cinema.
What I would like to do is to write a SELECT statement that would find all the empty and continuous seats grouped by one, two, three, four, five, etc. according to the number of tickets the user desires. The only way I can think of is many Self-Joins...Is there a better way?
Thank you for your help in advance...and sorry for the long message...

0 user(s) are reading this topic

0 members, 0 guests, 0 anonymous users