1. Advertising
    y u no do it?

    Advertising (learn more)

    Advertise virtually anything here, with CPM banner ads, CPM email ads and CPC contextual links. You can target relevant areas of the site and show ads based on geographical location of the user if you wish.

    Starts at just $1 per CPM or $0.10 per CPC.

Get only some section of results

Discussion in 'MySQL' started by Tony Brar, Aug 20, 2013.

Thread Status:
Not open for further replies.
  1. #1
    Hi guys,
    I know about the LIMIT feature of MySQL to get only the first x number of results, but what if I want to get results 10-20, 20-50, etc...
    Reason I need it:
    When people search for stuff on my site, I want to only return first 20 results, then they can choose to get more results. I don't want to fetch more data than necessary, these queries are going to be very big.

    Thanks,
    -Tony
     
    Solved! View solution.
    Tony Brar, Aug 20, 2013 IP
  2. #2
    the syntax is:
    [LIMIT {[offset,] row_count | row_count OFFSET offset}]
    so if you want to start at 20 and get the next 20 you have
    limit 20, 20
    if you want to start at 60 and get the next 20 it's
    limit 60, 20
     
    sarahk, Aug 20, 2013 IP
  3. Tony Brar

    Tony Brar Active Member

    Messages:
    220
    Likes Received:
    2
    Best Answers:
    0
    Trophy Points:
    75
    #3
    Thanks!
    That's what I was looking for.
     
    Tony Brar, Aug 21, 2013 IP
Thread Status:
Not open for further replies.