B
bdehning
I have been struggling for days to try and figure out how to get correct counts in my report. I have a table [Account Information] that has primary key Policy number which is joined 1-many to a [Location] table. I have "Controlling Consultant" in the table [Account Information] and "Assigned Consultant" in the [Location] Table. They is only one policy number for each account in account information but there can be many locations for each policy number in [Location].
My joined query produces a correct report with accurate counts for "Controlling consultant". The query I produce for assigned consultant produces counts for each entry is there are more than 1 location. When I do a count of "assigned Consultant" I get numbers reflecting the number of locations.
Barry - 3
Don -4
Chuck -5
I would like to be able to count such that each person at the [location] level is counted just once so it would show
Barry -1
Don -1
Chuck -1
Here is the SQL that gives me the wrong totals
SELECT DISTINCT Location.[Assigned Consultant], [Account Information].[Policy Number], [Account Information].[Account Name], [Account Information].EAP, [Account Information].[Class Code], [Account Information].[Expiration Date], [Account Information].[Service Frequency], [Account Information].[Nature of Operations], Sum([Account Information].EAP) AS SumOfEAP, [Account Information].[X-Mod], Count(Location.[Assigned Consultant]) AS [CountOfAssigned Consultant], Location.[Location Servicing Division]
FROM [Account Information] LEFT JOIN Location ON [Account Information].[Policy Number] = Location.[Policy Number]
GROUP BY Location.[Assigned Consultant], [Account Information].[Policy Number], [Account Information].[Account Name], [Account Information].EAP, [Account Information].[Class Code], [Account Information].[Expiration Date], [Account Information].[Service Frequency], [Account Information].[Nature of Operations], [Account Information].[X-Mod], Location.[Location Servicing Division]
HAVING (((Location.[Assigned Consultant]) Like [Enter Assigned Consultant] & "*"));
Can any one help me figure this out? I have tried to work with the SQL but keep getting From clause problems and have tried reading other postes with no success so far.
Is there away to exclude the duplicates in the report by chance?
Brian
My joined query produces a correct report with accurate counts for "Controlling consultant". The query I produce for assigned consultant produces counts for each entry is there are more than 1 location. When I do a count of "assigned Consultant" I get numbers reflecting the number of locations.
Barry - 3
Don -4
Chuck -5
I would like to be able to count such that each person at the [location] level is counted just once so it would show
Barry -1
Don -1
Chuck -1
Here is the SQL that gives me the wrong totals
SELECT DISTINCT Location.[Assigned Consultant], [Account Information].[Policy Number], [Account Information].[Account Name], [Account Information].EAP, [Account Information].[Class Code], [Account Information].[Expiration Date], [Account Information].[Service Frequency], [Account Information].[Nature of Operations], Sum([Account Information].EAP) AS SumOfEAP, [Account Information].[X-Mod], Count(Location.[Assigned Consultant]) AS [CountOfAssigned Consultant], Location.[Location Servicing Division]
FROM [Account Information] LEFT JOIN Location ON [Account Information].[Policy Number] = Location.[Policy Number]
GROUP BY Location.[Assigned Consultant], [Account Information].[Policy Number], [Account Information].[Account Name], [Account Information].EAP, [Account Information].[Class Code], [Account Information].[Expiration Date], [Account Information].[Service Frequency], [Account Information].[Nature of Operations], [Account Information].[X-Mod], Location.[Location Servicing Division]
HAVING (((Location.[Assigned Consultant]) Like [Enter Assigned Consultant] & "*"));
Can any one help me figure this out? I have tried to work with the SQL but keep getting From clause problems and have tried reading other postes with no success so far.
Is there away to exclude the duplicates in the report by chance?
Brian