Home | Contact Us | FAQ | Search & Site Map | Link to Us
Sign In | Join | Other 45 Sites in Network
Home
Discussion GroupsFormsForms ProgrammingQueriesModules / DAO / VBAReports / PrintingMacrosDatabase DesignSecurityConversionImporting / LinkingSQL Server / ADPMultiuser / NetworkingReplicationSetup / ConfigurationDeveloper ToolkitsActiveX ControlsNew UsersGeneral 1General 2
Access DirectoryToolsTutorialsUser Groups
Related Topics
SQL ServerOther DB ProductsMS OfficeMore Topics ...

MS Access Forum / Queries / October 2007

Tip: Looking for answers? Try searching our database.

Duplicates - Query Joining

Thread view: 
Enable EMail Alerts  Start New Thread
Thread rating: 
jenniferspnc - 26 Oct 2007 21:36 GMT
Okay, I've posted and tried.  I'm not sure if the problem is in my tables.  
Anyways I have two queries that produce results based on different date
ranges.  I want both of those to pull into one query and then I can build a
report.

FYI - my table is as such
GGP
Customer
Month
GAAP
Direct

As you may know I have several records for one customer hence the month
field.  
One query pulls in the records and sums based on the prior 12 months.  The
other query pulls in records and sums based on the 12 months prior to the
first query.  

Problem is when I run the query that pulls in fields from the other two
queries I get duplicates.  I've created a relationship from GGP in the one
query to the GGP in the other.  That might be the problem??? Not sure how to
fix.  Anyways the results from the below query pull in each record 3 times.  
I've had some help but either misunderstood or wasn't clear on what I
have...it's been a challenge for me all day.  Thanks in advance for your help
and patience.

So I try to join the queries and here's the SQL Statement:
SELECT DISTINCTROW [GAM Metric Totals Previous Year Rolling Query].GGP, [GAM
Metric Totals Previous Year Rolling Query].[Company Name], [GAM Metric Totals
Query1].Month, [GAM Metric Totals Previous Year Rolling Query].Month, [GAM
Metric Totals Previous Year Rolling Query].[Headquarter Country], [GAM Metric
Totals Previous Year Rolling Query].[Sum Of GAAP] AS [Sum Of GAM Metric
Totals Previous Year Rolling Query_Sum Of GAAP], [GAM Metric Totals Previous
Year Rolling Query].[Sum Of Direct] AS [Sum Of GAM Metric Totals Previous
Year Rolling Query_Sum Of Dire], [GAM Metric Totals Previous Year Rolling
Query].[Sum Of GP] AS [Sum Of GAM Metric Totals Previous Year Rolling
Query_Sum Of GP], [GAM Metric Totals Previous Year Rolling Query].[Avg Of
Revenue at HQ] AS [Avg Of GAM Metric Totals Previous Year Rolling Query_Avg
Of Reve], [GAM Metric Totals Query1].[Sum Of GAAP] AS [Sum Of GAM Metric
Totals Query1_Sum Of GAAP], [GAM Metric Totals Query1].[Sum Of Direct] AS
[Sum Of GAM Metric Totals Query1_Sum Of Direct], [GAM Metric Totals
Query1].[Sum Of GP] AS [Sum Of GAM Metric Totals Query1_Sum Of GP], [GAM
Metric Totals Query1].[Avg Of Revenue at HQ] AS [Avg Of GAM Metric Totals
Query1_Avg Of Revenue at HQ]
FROM [GAM Metric Totals Query1] INNER JOIN [GAM Metric Totals Previous Year
Rolling Query] ON [GAM Metric Totals Query1].GGP = [GAM Metric Totals
Previous Year Rolling Query].GGP;
KARL DEWEY - 26 Oct 2007 22:07 GMT
There should not be duplicates if the first queries only pull records from
the correct year.  What kind of field is your 'Month'?  Is it a datetime
field or text?
Why do you need two queries to pull this data?
'Month' is a reserved word in Access and should not be used as an object name.
Signature

KARL DEWEY
Build a little - Test a little

> Okay, I've posted and tried.  I'm not sure if the problem is in my tables.  
> Anyways I have two queries that produce results based on different date
[quoted text clipped - 43 lines]
> Rolling Query] ON [GAM Metric Totals Query1].GGP = [GAM Metric Totals
> Previous Year Rolling Query].GGP;
 
Sign In
Join
My Latest Posts
My Monitored Threads
My Blog
My Photo Gallery
My Profile
My Homepage

Start New Thread
Enable EMail Alerts
Rate this Thread



©2008 Advenet LLC   Privacy Policy - Terms of Use
This website includes both content owned or controlled by Advenet as well as content owned or controlled by third parties.