Page 1 of 1

Sorting Data

Posted: Wed Nov 14, 2007 3:07 pm
by sparky256DSL
I want to sort ticket information from a database (Section, Row, Seat). I can retrieve the data from the database but what would be the best way to find consecutive seats? I want someone to be able to type in that they want 4 seats and it finds the four best seats (based on row number) that are consecutive seat in the same section. Any help would be great.


Thanks

Re: Sorting Data

Posted: Fri Nov 16, 2007 3:10 pm
by califdon
sparky256DSL wrote:I want to sort ticket information from a database (Section, Row, Seat). I can retrieve the data from the database but what would be the best way to find consecutive seats? I want someone to be able to type in that they want 4 seats and it finds the four best seats (based on row number) that are consecutive seat in the same section. Any help would be great.
It all depends on how your seating plan is constructed. If the seating is divided into Sections and Rows, and if the Sections are different across aisles, you should be able to determine whether seats are adjacent if they are in the same Section, the same Row, and have consecutive seat numbers (or 2 apart, if odds are on one side and evens on the other).

If seat designations are arbitrary, I'd suggest that you assign a "contiguous-seats-section" code to each seat and store it in a table. Then you could search for continuous numbers within a contiguous-seats-section.