SpyderMan1234
IS-IT--Management
I have a table that has information that looks like the following:
CaseID Crime CrimeTime
------ ----- ---------
1 Aggravated Assault 01/01/01 12:00 PM
2 First Degree Murder 01/15/02 12:00 PM
2 Aggravated Assault 01/15/02 12:05 PM
2 Vehicular Homicide 01/16/02 12:10 PM
3 Contr. Del. of a Minor 01/16/02 10:34 PM
3 DUI 01/16/02 10:40 PM
...
I have a query that does an ORDER BY CaseID, CrimeTime so that all of the CaseIDs are in order and, within them, the times go in order from earliest to latest. Simple enough...
What I need is a query that will give me just the first instance of each CaseID (in other words, the first crime that was logged for each case). So that my results look like this:
CaseID Crime CrimeTime
------ ----- ---------
1 Aggravated Assault 01/01/01 12:00 PM
2 First Degree Murder 01/15/02 12:00 PM
3 Contr. Del. of a Minor 01/16/02 10:34 PM
Any ideas? Any help is greatly appreciated!
THANKS!
CaseID Crime CrimeTime
------ ----- ---------
1 Aggravated Assault 01/01/01 12:00 PM
2 First Degree Murder 01/15/02 12:00 PM
2 Aggravated Assault 01/15/02 12:05 PM
2 Vehicular Homicide 01/16/02 12:10 PM
3 Contr. Del. of a Minor 01/16/02 10:34 PM
3 DUI 01/16/02 10:40 PM
...
I have a query that does an ORDER BY CaseID, CrimeTime so that all of the CaseIDs are in order and, within them, the times go in order from earliest to latest. Simple enough...
What I need is a query that will give me just the first instance of each CaseID (in other words, the first crime that was logged for each case). So that my results look like this:
CaseID Crime CrimeTime
------ ----- ---------
1 Aggravated Assault 01/01/01 12:00 PM
2 First Degree Murder 01/15/02 12:00 PM
3 Contr. Del. of a Minor 01/16/02 10:34 PM
Any ideas? Any help is greatly appreciated!
THANKS!