All,
I have been trying to work out how to select say 15 tickets within a single block of seats.
EDIT: the problem is - how to find all rect
First, I'm going to assume that most venues can be mapped (even if approximated) to a square grid, ie. where the seats aren't strangely setup or weirdly offset. As such, each seat may have up to eight seats around it.
CREATE TABLE Seat {
SeatID int,
Status int,
...
NorthID int,
NorthWestID int,
WestID int,
...
NorthEastID int
}
Essentially, I will be able to create a "seat graph" and walk it according to needs in querying. Then, you can create queries to get certain shapes or blocks.
A 3x3 grid would consist of selecting an open seat where the immediate linked seats in all directions are also open. Yes, it would be eight JOINS, but try it out and optimize later.
SELECT * FROM Seat x
INNER JOIN Seat n ON x.NorthID = n.SeatID
INNER JOIN Seat nw ON x.NorthWestID = n.SeatID
...
A 1x15 block would be a query to select an open seat where you join 14 deep along the EastID or WestID.
You can probably generalize and generate the queries programatically.
PS: Depending on which engine you are using, you may have built-in spatial capabilities.
Good luck.