davidb Posted December 26, 2003 Share Posted December 26, 2003 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... Quote Link to comment https://forums.phpfreaks.com/topic/1555-many-levels-in-a-self-join/ Share on other sites More sharing options...
Recommended Posts
Join the conversation
You can post now and register later. If you have an account, sign in now to post with your account.