I'm having some trouble with a query. I can't figure out what I'm doing wrong and I've been trying to get it for awhile now.
Basically when I run the query just using the one table (Type of Emergency Table) I get:
Query1
Type of Emergency Number of Calls ZipCode
Auto Accident 2 16933
Heart Attack 1 16950
Heart Attack 1 16910
Heart Attack 1 16901
Gunshot Wound 1 16901
Drowning 1 16910
Childbirth 1 16933
Childbirth 1 16901
And the SQL view shows
CODE
SELECT [Type of Emergency].[Type of Emergency], Count([Type of Emergency].[Type of Emergency]) AS [Number of Calls], [Type of Emergency].[Zip Code]
FROM [Type of Emergency]
GROUP BY [Type of Emergency].[Type of Emergency], [Type of Emergency].[Zip Code]
ORDER BY Count([Type of Emergency].[Type of Emergency]) DESC;
Which looks like the right data and I just have to add another table [the EMT] table and get the Base for the city from the Zip Code.
The problem is when I try to add the EMT table I get a different number of calls.
Query1 Type of Emergency Number of Calls Zip Code
Auto Accident 8 16933
Childbirth 4 16933
Heart Attack 3 16910
Heart Attack 3 16901
Gunshot Wound 3 16901
Drowning 3 16910
Childbirth 3 16901
CODE
SELECT [Type of Emergency].[Type of Emergency], Count([Type of Emergency].[Type of Emergency]) AS [Number of Calls], [Type of Emergency].[Zip Code]
FROM [Type of Emergency] INNER JOIN EMT ON [Type of Emergency].[Zip Code] = EMT.[Zip Code]
GROUP BY [Type of Emergency].[Type of Emergency], [Type of Emergency].[Zip Code]
ORDER BY Count([Type of Emergency].[Type of Emergency]) DESC;
I don't know why the numbers are coming out this way.
Does anyone have any clue what is going on. I've tried to do a tutorial with a similar problem and thought I understood but can't get this to work.