SitePoint Sponsor

User Tag List

Results 1 to 2 of 2

Hybrid View

  1. #1
    SitePoint Evangelist comfixit's Avatar
    Join Date
    Dec 2004
    Location
    Pasadena
    Posts
    537
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)

    How get last 5 records (in ASC order)

    Say I have a data field I am sorting by with the following values 1,2,3,4,5,6,7,8,9,10.

    If I were to limit 5 I would get 1,2,3,4,5

    If I were to limit 5 and order desc I would get 10,9,8,7,6

    What I want to get is 6,7,8,9,10

    Does anyone know a good way to limit a search to the last 5 records while keeping the data in ASC order in MySql?

  2. #2
    From Italy with love silver trophybronze trophy
    guido2004's Avatar
    Join Date
    Sep 2004
    Posts
    9,495
    Mentioned
    161 Post(s)
    Tagged
    4 Thread(s)
    Code MySQL:


Bookmarks

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •