I have a complex query I need help with: The table looks like this:
Comp_sk Prod_dt Rsn Down_hrs
1 7/25/2001 bb 8
2 5/1/2001 ms 12
2 5/18/2001 ga 14
2 5/25/2001 bb 12
2 8/1/2001 cc 7
2 8/15/2001 de 8
3 7/22/2001 ee 15
3 7/15/2001 er 9
I need to return a recordset that will give me each record that has the lastest date of each month, the total (sum) of the "down_hrs" for all records in that month and the other data in each of those records. ie
The set:
1 7/25/2001 bb 8
2 5/25/2001 bb 45
3 7/22/2001 ee 24
Is there any way to do this in a single query?
Comp_sk Prod_dt Rsn Down_hrs
1 7/25/2001 bb 8
2 5/1/2001 ms 12
2 5/18/2001 ga 14
2 5/25/2001 bb 12
2 8/1/2001 cc 7
2 8/15/2001 de 8
3 7/22/2001 ee 15
3 7/15/2001 er 9
I need to return a recordset that will give me each record that has the lastest date of each month, the total (sum) of the "down_hrs" for all records in that month and the other data in each of those records. ie
The set:
1 7/25/2001 bb 8
2 5/25/2001 bb 45
3 7/22/2001 ee 24
Is there any way to do this in a single query?