bumfuzzled
Programmer
Every week I import timehsheets and they may have duplicate entries So I end up with something that looks like this
Empl InvoiceIDActivityDate LeaseName Hours
703 136067 5/22/2008 Link Ranch #1 1.5
703 136067 5/22/2008 Link Ranch Bndry 10
What I need to do is filter for duplicates, and then add the hours field together, and add the comments and Lease name field of the second record onto the end of the same fields in the first record first record. I might have as many as five or six duplicates.
Here is my SQL statment so far, I am clueless from here
Empl InvoiceIDActivityDate LeaseName Hours
703 136067 5/22/2008 Link Ranch #1 1.5
703 136067 5/22/2008 Link Ranch Bndry 10
What I need to do is filter for duplicates, and then add the hours field together, and add the comments and Lease name field of the second record onto the end of the same fields in the first record first record. I might have as many as five or six duplicates.
Here is my SQL statment so far, I am clueless from here
Code:
SELECT [Copy Of Time].EmployeeID, [Copy Of Time].InvoiceID, [Copy Of Time].ActivityDate, [Copy Of Time].LeaseName, [Copy Of Time].Hours, [Copy Of Time].Comments FROM [Copy Of Time]WHERE ((([Copy Of Time].EmployeeID) In (SELECT [EmployeeID] FROM [Copy Of Time] As Tmp GROUP BY [EmployeeID],[InvoiceID],[ActivityDate] HAVING Count(*)>1 And [InvoiceID] = [Copy Of Time].[InvoiceID] And [ActivityDate] = [Copy Of Time].[ActivityDate])))ORDER BY [Copy Of Time].EmployeeID, [Copy Of Time].InvoiceID, [Copy Of Time].ActivityDate;