1. Welcome to TechPowerUp Forums, Guest! Please check out our forum guidelines for info related to our community.

php / sql question

Discussion in 'Programming & Webmastering' started by Akumos, Jun 13, 2012.

  1. Akumos

    Akumos

    Joined:
    Nov 30, 2008
    Messages:
    535 (0.25/day)
    Thanks Received:
    27
    Location:
    Birmingham, England...
    Hello

    I want to list things by date... but skip the newest... is this possible?

    i imagine something like...

    PHP:
    SELECT FROM table ORDER BY date //at position 2 ???
    thanks in advance :)
     
  2. W1zzard

    W1zzard Administrator Staff Member

    Joined:
    May 14, 2004
    Messages:
    14,854 (3.93/day)
    Thanks Received:
    11,559
    use ORDER BY and LIMIT
     
    Akumos says thanks.
  3. Akumos

    Akumos

    Joined:
    Nov 30, 2008
    Messages:
    535 (0.25/day)
    Thanks Received:
    27
    Location:
    Birmingham, England...
    thanks w1zzard - can look it up now I know the syntax!!
     
  4. Akumos

    Akumos

    Joined:
    Nov 30, 2008
    Messages:
    535 (0.25/day)
    Thanks Received:
    27
    Location:
    Birmingham, England...
    just googled it... perfect - thanks again!
     
  5. temp02 New Member

    Joined:
    Mar 18, 2009
    Messages:
    493 (0.25/day)
    Thanks Received:
    166
    You probably are after the OFFSET keyword.
     
  6. Aquinus

    Aquinus Resident Wat-man

    Joined:
    Jan 28, 2012
    Messages:
    6,264 (6.50/day)
    Thanks Received:
    2,077
    Location:
    Concord, NH
    Code:
    SELECT *
    FROM table
    ORDER BY date
    LIMIT 1 OFFSET 2
     
    Akumos says thanks.
  7. Akumos

    Akumos

    Joined:
    Nov 30, 2008
    Messages:
    535 (0.25/day)
    Thanks Received:
    27
    Location:
    Birmingham, England...
    ok... would that do the same as

    PHP:
    LIMIT 12
    ?
     
  8. W1zzard

    W1zzard Administrator Staff Member

    Joined:
    May 14, 2004
    Messages:
    14,854 (3.93/day)
    Thanks Received:
    11,559
    yep, same thing
     
  9. Akumos

    Akumos

    Joined:
    Nov 30, 2008
    Messages:
    535 (0.25/day)
    Thanks Received:
    27
    Location:
    Birmingham, England...
    cheers guys! appreciate the help!
     

Currently Active Users Viewing This Thread: 1 (0 members and 1 guest)

Share This Page