Jump to content

Many levels in a self-join


davidb

Recommended Posts

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...

Link to comment
Share on other sites

This thread is more than a year old. Please don't revive it unless you have something important to add.

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.

Guest
Reply to this topic...

×   Pasted as rich text.   Restore formatting

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

×
×
  • Create New...

Important Information

We have placed cookies on your device to help make this website better. You can adjust your cookie settings, otherwise we'll assume you're okay to continue.