I am working on a reservation system. The user enters the number of seats that they want to reserve, and the database will return a set of recommended places that have not previously been reserved, which corresponds to the number of seats reserved.
For example, if I had a table:
SeatID | Reserved ----------------- 1 | false 2 | true 3 | false 4 | false 5 | false 6 | true 7 | true 8 | false 9 | false 10 | true
And the user enters that they want to reserve 2 places, I expect the request to return that places (3, 4), (4, 5) and (8, 9) are not reserved and correspond to the specified number of input places. Seats are organized in sections and rows. Continuous seats should be in the same row.
How would I like to structure this query to work in such a way that it finds all available permanent locations matching this input?
source share