Neohapsis is currently accepting applications for employment. For more information, please visit our website www.neohapsis.com or email email@example.com
Re: How do I get x rows after ordering and grouping?
From: Daniel Dittmar (daniel.dittmarsap.com)
Date: Mon Mar 21 2005 - 16:52:48 CST
José Rómulo Elías Contreras wrote:
> How do I get x number of rows in a select statement after ordering
> and grouping?
> I have the next select statement:
> SELECT * FROM SALES ORDER BY CREATION_DATE
> This statement give me many rows, but I only need de first 20
> rows, or only I need the rows 20 to 40, or only I need the last 20 rows,
> it depends.
> Are there any form to handle it?
There is a two part workaround:
- MaxDB uses server side cursors, so if you stop reading records after x
rows, there isn't a great cost associated
- most programming interfaces allow you to position to a specific
record. And if you give a negative index to these methods, the position
from the end of the result set is used. By positioning to row -20, you
would read the last 20 rows.
SAP Labs Berlin
MaxDB Discussion Mailing List
For list archives: http://lists.mysql.com/maxdb