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 4 of 4
  1. #1
    Regular Coder
    Join Date
    Oct 2012
    Location
    mother land --india
    Posts
    165
    Thanks
    38
    Thanked 2 Times in 2 Posts

    command to read last before value in a column

    Hi All,

    I am looking for a command that can read last before value in a particular column. Please help me.


    Thanks & Regards,
    Nani
    Back on coding...

  • #2
    Master Coder felgall's Avatar
    Join Date
    Sep 2005
    Location
    Sydney, Australia
    Posts
    6,642
    Thanks
    0
    Thanked 649 Times in 639 Posts
    Use DESC with the ORDER BY and simply read the next entry > or < the one you have.
    Stephen
    Learn Modern JavaScript - http://javascriptexample.net/
    Helping others to solve their computer problem at http://www.felgall.com/

    Don't forget to start your JavaScript code with "use strict"; which makes it easier to find errors in your code.

  • #3
    Regular Coder
    Join Date
    Oct 2012
    Location
    mother land --india
    Posts
    165
    Thanks
    38
    Thanked 2 Times in 2 Posts
    felgall,

    I am sorry i did not understand.

    I have only one column i.e., ID with values 1, 2, 3, 4, 5 and now I want to know which query will help me to get only 5 as a value. I am finding difficult to find the command as I have no other value to perform where function else it would be very basic to find.

    another condition I have is, if I insert 6 as an another value the query should get 6 not 5..... in simple i want to know only last value of the column.

    Please help me for this assignment.

    Thanks & Regards,
    nani

  • #4
    Super Moderator
    Join Date
    May 2005
    Location
    Southern tip of Silicon Valley
    Posts
    2,874
    Thanks
    2
    Thanked 164 Times in 159 Posts
    Code:
    select max(ID) from tablename;


  •  

    Posting Permissions

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