SQL Query - Finding Consecutive Seats
- or -
Post a project like this2195
$150
- Posted:
- Proposals: 2
- Remote
- #1961227
- PRE-FUNDED
- Awarded
Description
Experience Level: Expert
I have a table of seats for my theater.
Seat ID | Section | Row | SeatNumber
1 A 1 1
2 A 1 2
3 A 1 3
4 A 1 4
5 A 1 5
6 A 1 6
7 A 1 7
8 A 2 1
9 A 2 2
10 A 2 3
I also have a table of ticket sales.
seatID | Section | Row | seatnumber | status
3 A 1 3 SOLD
My customer chooses 4 tickets and I need a query to then choose 4 seats in the same section AND row that are next to each other (consecutive seats) that are NOT in Ticketsales table as SOLD. I do not want skipped seats and I do not want half seats in row 1 and half of the seats in row 2. All seats consecutively in a row, no gaps.
Need this done today. I have attached an MS access file with the three tables for reference. My database is a godaddy hosted sql server that works like a champ. I would prefer to do all query building in the access file rather than give access to my sql server.
Seat ID | Section | Row | SeatNumber
1 A 1 1
2 A 1 2
3 A 1 3
4 A 1 4
5 A 1 5
6 A 1 6
7 A 1 7
8 A 2 1
9 A 2 2
10 A 2 3
I also have a table of ticket sales.
seatID | Section | Row | seatnumber | status
3 A 1 3 SOLD
My customer chooses 4 tickets and I need a query to then choose 4 seats in the same section AND row that are next to each other (consecutive seats) that are NOT in Ticketsales table as SOLD. I do not want skipped seats and I do not want half seats in row 1 and half of the seats in row 2. All seats consecutively in a row, no gaps.
Need this done today. I have attached an MS access file with the three tables for reference. My database is a godaddy hosted sql server that works like a champ. I would prefer to do all query building in the access file rather than give access to my sql server.
Charlie M.
100% (4)Projects Completed
3
Freelancers worked with
3
Projects awarded
22%
Last project
22 May 2018
United States
New Proposal
Login to your account and send a proposal now to get this project.
Log inClarification Board Ask a Question
-
What does the output need to give you...
The starting seat no? and ending seat no? or the full range
(This will require two queries I think)
Do you only want the first availble option or all?Charlie M.03 Apr 2018I am looking for the Full Range of seats matching N consecutive seat numbers. First Available option, priority given to the lower Seatrow number. I put a deposit down already. If we can't get it to my liking, I will hit you up. Thanks Mark
620604
We collect cookies to enable the proper functioning and security of our website, and to enhance your experience. By clicking on 'Accept All Cookies', you consent to the use of these cookies. You can change your 'Cookies Settings' at any time. For more information, please read ourCookie Policy
Cookie Settings
Accept All Cookies