SELECT TOP N seats.*, eventtickets.eticketprice from seats INNER JOIN eventtickets ON eventtickets.etickettype = seats.seattype WHERE ((Seats.seatType ='BOXSEAT') AND seatID not in (select seatID from ticketsales WHERE eventID=6)) ORDER BY convert (int, seats.seatSection), seats.seatrow ASC
My query above generates the best available # of N seats, but it will fill up one section and then the rest of that order is put in the next section. I need it to find a new section that has all N seats available. IF a seat is in
TicketSales table it is not available. If
salecategory is Null then that means ticket has not been SOLD/BLOCK/HOLD so its Available.
It is obviously limited to 6 seats together, but I do have one section which has over 30 seats in one row.
Section 1: Row 1: 1-2-3 Row 2: 4-5-6 Section 2: Row 1: 1-2-3 Row 2: 4-5-6
I am at my wits end. Been staring at this for 2 days straight and my mind is mush. I am pretty weak at SQL, amazing I got this far above. I think I have gotten close, but no enchilada.
See pics of the 2 main tables attached. I just need the
eventtickets table so it's not that important.
I thank you for any help you can give me on this.