SitePoint Sponsor

User Tag List

Results 1 to 3 of 3
  1. #1
    SitePoint Zealot
    Join Date
    Mar 2006
    Posts
    133
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)

    Simple select limit query

    Hi, i am picking out the last ten entries to my database but how can i pick out the next ten after that for instance:
    I have this at the moment for picking out the entries:
    sortcolumn is the date/time field:

    PHP Code:
    SELECT FROM table ORDER BY sortcolumn DESC LIMIT 10
    What i want is to go to the next page and it picks out the next ten.
    So something like

    PHP Code:
    SELECT FROM table ORDER BY sortcolumn DESC LIMIT 20;

    then somehow knock off the first ten
    I hope i make sense!

    Any help apreciated.

    David

  2. #2
    SQL Consultant gold trophysilver trophybronze trophy
    r937's Avatar
    Join Date
    Jul 2002
    Location
    Toronto, Canada
    Posts
    39,350
    Mentioned
    63 Post(s)
    Tagged
    3 Thread(s)
    LIMIT 10,10

    the first number is the number of rows to skip over
    rudy.ca | @rudydotca
    Buy my SitePoint book: Simply SQL
    "giving out my real stuffs"

  3. #3
    SitePoint Zealot
    Join Date
    Mar 2006
    Posts
    133
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)
    Thank you


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
  •