Hi,
i'm trying to find an efficient way to find a subportion of a large grid. Currently I'm looping through rows to define a FROM-TO selection of ids in that row, but this doesn't feel right...
Let's say I have a grid of 200x200 fields (x between 1 and 200, y between 1 and 200). Every field also has it's unique ID, starting at X1,Y1 (fieldid = 1) to X200,Y200 (fieldid = 40000).
I have a subportion of the grid that I need to select from the database (based on XY-ranges or unique id's, where uniqueids are much faster so preferred). The subportion is defined by the upperleft field (again based on XY value or a unique id) and then 16 fields wide and 9 fields high.
So, how can I efficiently select a subgrid of 144 fields (16x9) of a large grid of 40000 fields (200x200) based on the unique-id or XY-value of the upperleft field in the 16x9 subgrid?