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
    Oct 2009
    Posts
    445
    Thanks
    7
    Thanked 3 Times in 3 Posts

    How do I find a single record and the next record after it only

    I wish to query for an entry using `Pid` and the one that follows after it, using ORDER BY `Pid`

    The `Pid` is not always nubmers. There is no "index" due to this.

  • #2
    New Coder
    Join Date
    Mar 2010
    Posts
    30
    Thanks
    0
    Thanked 1 Time in 1 Post
    I'm not used to working with non-numeric indexes but this should work:

    Code:
    SELECT * FROM the_table 
    WHERE Pid >= 'the_index' 
    ORDER BY Pid ASC 
    LIMIT 2;
    Note that this is just going to get the two next to each other in alphabetical order, so I hope that's what you need.


  •  

    Posting Permissions

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