Results 1 to 4 of 4
  1. #1
    Join Date
    Feb 2003
    Posts
    29

    Unanswered: SQL Query Data collection.

    Here is my data

    ConfirmationNumber SequenceNumber StartDateTime EndDateTime
    100001 1 04/18/2010 09:10 04/18/2010 09:20
    100001 2 04/18/2010 09:13 04/18/2010 09:25
    100001 3 04/18/2010 09:15 04/18/2010 09:29
    100001 4 04/18/2010 09:20 04/18/2010 09:45

    What I need is following in my result set. which StartDateTime from first record and EndDateTime from Last recarod which is 04/18/2010 09:45

    ConfirmationNumber SequenceNumber StartDateTime EndDateTime
    100001 1 04/18/2010 09:10 04/18/2010 09:45

    How I can query this ?

    Appreicate your help in advance.

    KM

  2. #2
    Join Date
    Feb 2004
    Location
    In front of the computer
    Posts
    15,579
    Provided Answers: 54
    What defines the "firstness" and the "lastness" for you?

    -PatP
    In theory, theory and practice are identical. In practice, theory and practice are unrelated.

  3. #3
    Join Date
    Feb 2003
    Posts
    29
    Min - StartDateTime
    Max - StopDateTime

  4. #4
    Join Date
    Feb 2004
    Location
    In front of the computer
    Posts
    15,579
    Provided Answers: 54
    If that's what you want, then:
    Code:
    SELECT ConfirmationNumber, SequenceNumber, StartDateTime, (SELECT Max(EndDateTime) FROM it) AS EndDateTime FROM it WHERE StartDateTime = (SELECT Min(StartDateTime) FROM it)
    -PatP
    In theory, theory and practice are identical. In practice, theory and practice are unrelated.

Posting Permissions

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