getting the most latest date

Collapse
This topic is closed.
X
X
 
  • Time
  • Show
Clear All
new posts
  • TGEAR

    getting the most latest date

    I have a column which stores dates (datetime data type). I would like
    to fetch one data which is the most latest date among them. So if there
    are 04/01/06, 05/08/06, 05/12/06, 06/15/06, then 06/15/06 is the one I
    need to output.

    how can I write this in sql stmt?
    select datebegin
    from testtable
    where datebegin = ?????

    I don't think it is simple as I thought. I have no idea what I need to
    write in where clause to make this work.
    thanks.

  • rudianus

    #2
    Re: getting the most latest date

    select MAX(datebegin) from testtable

    TGEAR wrote:[color=blue]
    > I have a column which stores dates (datetime data type). I would like
    > to fetch one data which is the most latest date among them. So if there
    > are 04/01/06, 05/08/06, 05/12/06, 06/15/06, then 06/15/06 is the one I
    > need to output.
    >
    > how can I write this in sql stmt?
    > select datebegin
    > from testtable
    > where datebegin = ?????
    >
    > I don't think it is simple as I thought. I have no idea what I need to
    > write in where clause to make this work.
    > thanks.[/color]

    Comment

    Working...