Results 1 to 2 of 2
  1. #1
    Join Date
    Feb 2012
    Posts
    3

    Question First & Last records in a group

    Hi there, I have a group of records like this;

    NAME| RUN START| RUN END| LK1| LK2| DESC
    Graeme Brown| 2012-02-23 07:20:00.0000000| 2012-02-23 07:50:00.0000000| 2213| 2244| AK1/4/PI2
    Graeme Brown| 2012-02-23 08:00:00.0000000| 2012-02-23 09:25:00.0000000| 2244| 2052| AK1/4/PI2
    Graeme Brown| 2012-02-23 09:30:00.0000000| 2012-02-23 11:05:00.0000000| 2052| 917| AK1/4/PI2
    Graeme Brown| 2012-02-23 12:15:00.0000000| 2012-02-23 13:55:00.0000000| 917| 2052| AK1/4/PI2
    Graeme Brown| 2012-02-23 14:05:00.0000000| 2012-02-23 15:40:00.0000000| 2052| 1111| AK1/4/PI2

    I want to get;

    NAME| RUN START| RUN END| LK1| LK2| DESC
    Graeme Brown| 2012-02-23 07:20:00.0000000| 2012-02-23 15:40:00.0000000| 2213| 1111| AK1/4/PI2

    So what it needs to do is combine the ;

    earliest RUN START and corresponding LK1 with
    latest RUN END and corresponding LK2

    Can anyone please help? I've tried creating temp tables with the mins and maxs - but then I can't combine them with the LK1 and Lk2 fields...
    I'm a bit lost...

    Thank you in advance!

  2. #2
    Join Date
    Feb 2008
    Location
    Japan
    Posts
    3,483
    Last edited by tonkuma; 02-11-12 at 06:04. Reason: Add ANSI SQL

Posting Permissions

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