In the SQL below of my query A, qryIncident Master File, the field “[DOIYear]” is formatted as “yyyy” to give me the correct Year. I want another query B to sum the total number of incidents grouped by Year, [DOIYear]. I can’t get the grouped query to work properly; it will group the year and treat is as a “date” and not year. If someone could give a suggestion, it would be great!
Query A:
SELECT [tblIncidents Master File].IncidentRptID, [tblIncidents Master File].DOIncident, [tblIncidents Master File].DOIncident AS DOIYear, [tblIncidents Master File].Incident, [tblIncidents Master File].Section, [tblIncidents Master File].Remarks, Count([tblIncidents Master File].DOIncident) AS [Count]
FROM [tblIncidents Master File]
GROUP BY [tblIncidents Master File].IncidentRptID, [tblIncidents Master File].DOIncident, [tblIncidents Master File].DOIncident, [tblIncidents Master File].Incident, [tblIncidents Master File].Section, [tblIncidents Master File].Remarks;
Query B:
SELECT [qryIncidents Master File].DOIYear, Count([qryIncidents Master File].DOIYear) AS CountOfDOIYear
FROM [qryIncidents Master File]
GROUP BY [qryIncidents Master File].DOIYear;
Query A:
SELECT [tblIncidents Master File].IncidentRptID, [tblIncidents Master File].DOIncident, [tblIncidents Master File].DOIncident AS DOIYear, [tblIncidents Master File].Incident, [tblIncidents Master File].Section, [tblIncidents Master File].Remarks, Count([tblIncidents Master File].DOIncident) AS [Count]
FROM [tblIncidents Master File]
GROUP BY [tblIncidents Master File].IncidentRptID, [tblIncidents Master File].DOIncident, [tblIncidents Master File].DOIncident, [tblIncidents Master File].Incident, [tblIncidents Master File].Section, [tblIncidents Master File].Remarks;
Query B:
SELECT [qryIncidents Master File].DOIYear, Count([qryIncidents Master File].DOIYear) AS CountOfDOIYear
FROM [qryIncidents Master File]
GROUP BY [qryIncidents Master File].DOIYear;