MySQL Forums
Forum List  »  Newbie

Re: how to retrieve specific number of rows
Posted by: Roland Bouman
Date: August 04, 2005 06:43PM

Whaom! You did again felix! I really should familiarize myself more with this LIMIT feature. But, shouldnt the ORDER BY also have a DESC?

I mean, this statement sais:

give me all the records, order them, in ascending order (that's old ones first, then the newer ones), then return them starting from row number 5 (which is actually the 6th row, because the first has row number 0) up to that large integer 10000000 or so.

So by saying

SELECT *
FROM t
ORDER BY ts DESC
LIMIT 5, 10000000

we do the same thing, but with a reversed (first the new ones e.g. with larger ts values, then the older ones) order for the ts column. (you can write ASC explicitly, but its also the default, so you rarely see it written out)

(BTW Sorry ibakebread for causing the confusion. )

Options: ReplyQuote




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.