Hello and welcome to our community! Is this your first visit?
Register
Enjoy an ad free experience by logging in. Not a member yet? Register.
Results 1 to 2 of 2
  1. #1
    Regular Coder
    Join Date
    Jul 2005
    Posts
    216
    Thanks
    0
    Thanked 0 Times in 0 Posts

    why doesnt limit work fully

    Why is it, when you have a query, and you limit something, it doesntlimit the records searched? such as, i have a query that searches for "joe" and puts it in ASC order and limit 5, itll go through all joe's, is limit only good for displaying records, such as only 5 records show, ? if that made any sense

  • #2
    Super Moderator guelphdad's Avatar
    Join Date
    Mar 2006
    Location
    St. Catharines, Ontario Canada
    Posts
    2,634
    Thanks
    4
    Thanked 148 Times in 139 Posts
    in a select yes the limit is only telling how many records to display and which ones dependent on an order by clause.

    if you use

    Code:
    select
    foo,
    bar,
    qux
    from yourtable
    order by foo
    limit 5
    it would show the first five records according to foo ascending.

    limit 5 can be rewritten as 0,5 which says start at row 0 and show 5 records.

    if you used limit 5,5 it says to start at record after 5 and show the next five records.


  •  

    Posting Permissions

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