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 3 of 3
  1. #1
    New Coder
    Join Date
    Apr 2005
    Posts
    13
    Thanks
    0
    Thanked 0 Times in 0 Posts

    selecting the next record

    hi
    i am building an application where online orders r passed on to sales agents by sequence. eg. after agent A, B gets the next order then C, D, E etc.....

    assuming C got the last order now i have to select the next record from users table(below) i.e D, i need help with the select statement or any hint to solve this.

    Users table
    ********
    A
    B
    C
    D
    E


    thanks

  • #2
    Senior Coder Spudhead's Avatar
    Join Date
    Jun 2002
    Location
    London, UK
    Posts
    1,856
    Thanks
    8
    Thanked 110 Times in 109 Posts
    If I understand you right, you're going to need some sort of flag to say which agent got the last order. It's difficult to say without understanding more about your application logic but you could, for example, store the name of the last agent to receive an order in an application variable each time you place an order. Then you just need to retrieve that variable each time, apply some simple logic to get the name of the next agent, and use that in your SELECT statement. Make sense?

  • #3
    Senior Coder
    Join Date
    Nov 2002
    Location
    North-East, UK
    Posts
    1,265
    Thanks
    0
    Thanked 0 Times in 0 Posts
    If your last order holds the agent then you can lookup the last order get the agent then move to the next.

    How you do this depends on the design.
    If they are A, B, C etc. then you could get the Ascii value of the last agent then add 1. It will get the next letter.


  •  

    Posting Permissions

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