Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations Chris Miller on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

Query: finding lastest 6, but then the 6 before that?

Status
Not open for further replies.

elck

Programmer
Apr 19, 2004
176
NL
It is easy to find the latest 6 entries I think, something with limit I presume and order DESC?

But how do I find the 6 before the 6 latest?
and then back until to first?

Sorry, but I am still very much a beginner at this.

(I have an auto-increment integer(=ID) and a timestamp field)
 
To get the latest 6:[tt]
ORDER BY fld DESC LIMIT 6[/tt]
To get the next 6:[tt]
ORDER BY fld DESC LIMIT 6,6[/tt]
To get the rest:[tt]
ORDER BY fld DESC LIMIT 12,99999[/tt]
 
Thanks Tony I think I get it.
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top