A Microsoft Office (Excel, Word) forum. OfficeFrustration

If this is your first visit, be sure to check out the FAQ by clicking the link above. You may have to register before you can post: click the register link above to proceed. To start viewing messages, select the forum that you want to visit from the selection below.

Go Back   Home » OfficeFrustration forum » Microsoft Access » Running & Setting Up Queries
Site Map Home Register Authors List Search Today's Posts Mark Forums Read  

1 to Many. Duplicate field values



 
 
Thread Tools Display Modes
  #1  
Old November 30th, 2006, 08:08 PM posted to microsoft.public.access.queries
KARL DEWEY
external usenet poster
 
Posts: 10,767
Default 1 to Many. Duplicate field values

If the data in table2 is a roll-up report of table1 data I see two ways to
go. Just use as a subreport. Or use report Sorting And Grouping and have
a group footer to sum the group totals.

"Aquestion" wrote:

Table 1
Month Month_Num Cost Center Manager Hours_1 Team
Leader
Oct 10 1234567 J.Peters 20
M. Jane
Oct 10 1234567 J. Peters 16
S. Anthony
Oct 10 1234567 J.Peters 15
P.Qual
Oct 10 125467 A. Johnson 2
J.Jones

Table2
Month Month_Num Cost Center Hours_2
Oct 10 1234567 432
Oct 10 125467 562

The following is the SQL query. The result shows the Hours_2 field
duplicated for each cost center. For instance for Cost center "1234567" 432
Hours_2 is duplicated for all 3 records (all records where Cost Center =
"1234567"). This is a problem because when trying to sum this field,
duplicates are being counted (I am trying to sum this field in a report. ). I
don't want to add duplicates. I only want to add the number once for each
Cost Center. Any help? I am working on a deadline and this is the only field
in the report which is not computing correctly and its because of the Hours_2
field in this query. Can anyone please help??

SELECT [Srvc Mgmt Work Log Data].Month_Number_Reported, [Srvc Mgmt Work Log
Data].Month_Reported, [Srvc Mgmt Work Log Data].FTE_Type, [Srvc Mgmt Work Log
Data].[GMR IT Mgr], [Srvc Mgmt Work Log Data].Cost_Center, Sum([Srvc Mgmt
Work Log Data].[Total WorkLog]) AS [Total Month], [Srvc Mgmt Work Log
Data].[GMR IT TL], [GMR CATS Time tracking data].Hours
FROM [Srvc Mgmt Work Log Data] INNER JOIN [GMR CATS Time tracking data] ON
([Srvc Mgmt Work Log Data].Cost_Center = [GMR CATS Time tracking
data].Cost_Center) AND ([Srvc Mgmt Work Log Data].Month_Number_Reported =
[GMR CATS Time tracking data].Month_Number)
GROUP BY [Srvc Mgmt Work Log Data].Month_Number_Reported, [Srvc Mgmt Work
Log Data].Month_Reported, [Srvc Mgmt Work Log Data].FTE_Type, [Srvc Mgmt Work
Log Data].[GMR IT Mgr], [Srvc Mgmt Work Log Data].Cost_Center, [Srvc Mgmt
Work Log Data].[GMR IT TL], [GMR CATS Time tracking data].Hours
HAVING ((([Srvc Mgmt Work Log Data].FTE_Type)="MEDICAL"));

 




Thread Tools
Display Modes

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

vB code is On
Smilies are On
[IMG] code is Off
HTML code is Off
Forum Jump


All times are GMT +1. The time now is 03:04 AM.


Powered by vBulletin® Version 3.6.4
Copyright ©2000 - 2024, Jelsoft Enterprises Ltd.
Copyright ©2004-2024 OfficeFrustration.
The comments are property of their posters.