Query the early and latest date stamp

  • Hello,

    I have a table with huge data.

    TABLE A

    Oder ID

    ValidateFromData

    I needed to find out the begining/early and latest datestamp from ValidateFromData column.

    Can someone give some advice?

    Thanks,

    TJ

  • if your Datatype is a datetime type. then use this

    select min(validatefromdata) from TABLEA

    and select max(validatefromdata) from TABLEA

  • Mani,

    Thanks for your kind advise. It works. 🙂

  • Just in case you don't know... you can combine the two in a single select...

    SELECT MIN(ValidateFromDate) AS MinDate,

    MAX(ValidateFromDate) AS MaxDate

    FROM dbo.TableA

    --Jeff Moden


    RBAR is pronounced "ree-bar" and is a "Modenism" for Row-By-Agonizing-Row.
    First step towards the paradigm shift of writing Set Based code:
    ________Stop thinking about what you want to do to a ROW... think, instead, of what you want to do to a COLUMN.

    Change is inevitable... Change for the better is not.


    Helpful Links:
    How to post code problems
    How to Post Performance Problems
    Create a Tally Function (fnTally)

  • Jeff,

    Thank for the tips.

    TJ

Viewing 5 posts - 1 through 4 (of 4 total)

You must be logged in to reply to this topic. Login to reply