How to select :"MAX DATE" and :"Min date"

  • How i select from table

    1) MAX date from (long date format) field

    2) Min Date from (long date format) field

    and show only the MAX and MIN from the table

     

    thnks ilan

     

  • select max(myDateField) as MaxDate, min(myDateField) as MinDate from myTable

     

    Aunt Kathi Data Platform MVP
    Author of Expert T-SQL Window Functions
    Simple-Talk Editor

  • To add to Kathi: The date format you see, is not what is stored in a DATETIME column. Internally SQL Server stores such values as BINARY(8) containing 2 INTEGERs for date and time. This format is not very readable and is translated according to the settings each time the information is requested.

    --
    Frank Kalis
    Microsoft SQL Server MVP
    Webmaster: http://www.insidesql.org/blogs
    My blog: http://www.insidesql.org/blogs/frankkalis/[/url]

Viewing 3 posts - 1 through 2 (of 2 total)

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