ddschreck01
asked on
extract records with the smallest value per group
I have a table containing the following
Acct # Collection Date/Time Result Date/Time Clinical Event
000005 1/1/2014 00:10:00 1/1/2014 00:42:00 Troponin-T
000005 1/1/2014 00:15:00 1/1/2014 00:20:00 Troponin-I
000005 1/1/2014 01:30:00 1/1/2014 02:10:00 Troponin-T
001002 1/3/2014 23:59:00 1/4/2014 00:45:00 Troponin-T
001002 1/4/2014 05:20:00 1/4/2014 05:25:00 Troponin-I
I need a query that would pull the entire record with the earliest result time for each account.
For Acct # 0005, I need the record with result date/time of 1/1/2014 00:20:00 (2nd rec)
For Acct # 1002, I need the record with result date/time of 1/4/2014 00:45:00 (4th rec)
Acct # Collection Date/Time Result Date/Time Clinical Event
000005 1/1/2014 00:10:00 1/1/2014 00:42:00 Troponin-T
000005 1/1/2014 00:15:00 1/1/2014 00:20:00 Troponin-I
000005 1/1/2014 01:30:00 1/1/2014 02:10:00 Troponin-T
001002 1/3/2014 23:59:00 1/4/2014 00:45:00 Troponin-T
001002 1/4/2014 05:20:00 1/4/2014 05:25:00 Troponin-I
I need a query that would pull the entire record with the earliest result time for each account.
For Acct # 0005, I need the record with result date/time of 1/1/2014 00:20:00 (2nd rec)
For Acct # 1002, I need the record with result date/time of 1/4/2014 00:45:00 (4th rec)
ASKER CERTIFIED SOLUTION
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
ASKER