#1
  1. *Programmer In Training*
    Devshed Newbie (0 - 499 posts)

    Join Date
    Mar 2005
    Location
    SE London
    Posts
    371
    Rep Power
    12

    Get last set of records without looping back to record 1


    Hi Guys,

    Hoepfully a quicky here!

    I am working on a site, which requires a table to be screened, then every 10 records to be grabbed, and printed out to the screen.

    However, it's the last 10 records I'm having problems with!

    Basically I'm doing a simple LIMIT 0,10 - LIMIT 10,10 query and so on, but if I have a table that's 23 records populated, then on the 3rd repitition of the script (unfortunately at the moment it's 3 different querys, not being looped), we are printing the first 3 (rows 20,23), but also the next 7, from record 1 (1,7), I am totally confused, and would love some help, despite easy it might be!

    Regards,
    Joe.
  2. #2
  3. SQL Consultant
    Devshed Supreme Being (6500+ posts)

    Join Date
    Feb 2003
    Location
    Toronto Canada
    Posts
    27,212
    Rep Power
    4279
    Originally Posted by josephman1988
    ...we are printing the first 3 (rows 20,23), but also the next 7, from record 1 (1,7), I am totally confused
    so am i

    LIMIT doesn't work that way, so you're doing something wrong/different

    i'd love to critique your code and/or query, but i can't see it from here
    rudy.ca | @rudydotca
    Buy my SitePoint book: Simply SQL

IMN logo majestic logo threadwatch logo seochat tools logo