Results 1 to 5 of 5
  1. #1
    Join Date
    Oct 2002
    Location
    west midlands UK
    Posts
    4

    Angry Unanswered: Oldest/newst Date

    I have a history table which holds cilent information for each day. I need a SQL statement that will tell me the oldest and newest dates in the table.

    Any suggestions.

  2. #2
    Join Date
    Oct 2001
    Location
    Chicago
    Posts
    440
    SELECT N.Newest, O.Oldest
    FROM
    (SELECT TOP 1 Table.Date AS Newest
    FROM Table
    ORDER BY Table.Date DESC) as N,
    (SELECT TOP 1 Table.Date AS Oldest
    FROM Table
    ORDER BY Table.Date) as O;

  3. #3
    Join Date
    Nov 2001
    Posts
    336
    Select Max(MyDate), Min(MyDate) From tblMyData;

    Anything missed here?

    Igor

  4. #4
    Join Date
    Oct 2001
    Location
    Chicago
    Posts
    440
    duh...

    Only thing missed is my brain.

  5. #5
    Join Date
    Oct 2002
    Location
    west midlands UK
    Posts
    4

    Cool

    Originally posted by IGelin
    Select Max(MyDate), Min(MyDate) From tblMyData;

    Anything missed here?

    Igor
    Many Thanks....

Posting Permissions

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