I am having probems with getting the results that I need.
I am running oracle 7. I believe that more recent versions might have made this pretty easy, but...
I am providing a basic example of the data and what I hope to achieve.
Any assistance is greatly appreciated.
TIME MODEL SERIALNUM CODE
8:00 SRY 0123 0502
8:01 SRY 0124 0502
8:03 SRD 0125 0504
8:04 SRD 0126 0502
8:05 SRD 0126 0504
what I am trying to do is group by codes - but if I have a serial num listed more than once - only include the most recent time for that entry
currently I have:
select code, count(code) from final_collection
where code <> 'GOOD'
group by code
returns:
CODE count(code)
0502 3
0504 2
what I want is:
CODE count(code)
0502 2
0504 2
where the code 0502 for serialnum 0126 is not included since it's time is earlier than the 0504 record.
Thanks so much for any help.
I am running oracle 7. I believe that more recent versions might have made this pretty easy, but...
I am providing a basic example of the data and what I hope to achieve.
Any assistance is greatly appreciated.
TIME MODEL SERIALNUM CODE
8:00 SRY 0123 0502
8:01 SRY 0124 0502
8:03 SRD 0125 0504
8:04 SRD 0126 0502
8:05 SRD 0126 0504
what I am trying to do is group by codes - but if I have a serial num listed more than once - only include the most recent time for that entry
currently I have:
select code, count(code) from final_collection
where code <> 'GOOD'
group by code
returns:
CODE count(code)
0502 3
0504 2
what I want is:
CODE count(code)
0502 2
0504 2
where the code 0502 for serialnum 0126 is not included since it's time is earlier than the 0504 record.
Thanks so much for any help.