View Single Post

   
  #3 (permalink)  
Old 02-28-2008, 07:35 AM
Bill Karwin
 
Posts: n/a
Default Re: Select a range around a specific row

strawberry wrote:
> Unfortunately, I don't think you can use variables in the LIMIT clause


Correct. I recall that LIMIT accepts only literal integer constants,
not expressions.

> - whch would probably be necessary to make this work. It doesn't mean
> it can't be done. It just can't be done in a single elegant SELECT
> statement.


On the other hand, there are probably several solutions possible in
application code languages that are more elegant than what could be
possible in SQL.

Once you have an array containing all the values of the key values, app
languages like Java, Perl, or PHP give you the ability to easily select
elements from the array by subscript, calculate proportional position
within the range, and display subsets of the array.

Regards,
Bill K.
Reply With Quote