circumventing limitations on the "Liimit" clause
Guys,
I'm trying to do paging in a web app. Not being able to specify:
Limit vPageStart vPageEnd
dynamically (using vars) is a hastle. To adjust, I wrote the following SP:
SET @i:=0;
select tbl.RowNum, tbl.part from
(
SELECT @i:= @i+1 as RowNum, substr(ATL_Label,2,6) as part
from Label
Order by part
limit 30
) as tbl
where RowNum between 20 and 25 ;
and it works perfectly because mySQL is setting RowNum (assigning @i) AFTER it performs the "Order by" clause. However, I'm scared to depend upon this behavior because I don't know how or why it knows to delay assignment of RowNum until AFTER the sort. Is this a bug or a feature and can I count on it to keep behaving this way?? Any thoughts or explanations will be very appreciated!!
Subject
Views
Written By
Posted
circumventing limitations on the "Liimit" clause
4020
November 13, 2006 05:55PM
2530
November 15, 2006 12:36PM
2388
November 15, 2006 10:06PM
31330
January 08, 2007 09:09PM
3863
January 23, 2007 12:49AM
3118
August 29, 2007 08:25AM
2705
August 29, 2007 11:45AM
3627
August 29, 2007 12:29PM
3297
August 29, 2007 03:07PM
Sorry, you can't reply to this topic. It has been closed.
Content reproduced on this site is the property of the respective copyright holders.
It is not reviewed in advance by Oracle and does not necessarily represent the opinion
of Oracle or any other party.