i have the following query which is looking back at the last months six records and getting a total amount for these months but it is only pulling records for the last two months ie the new year.
what is wrong with this query??
HELP much appreciated
SELECT QCount_for_chart.[Type of Breach], QCount_for_chart.[Previous No/Ref], Count(QCount_for_chart.[Previous No/Ref]) AS [CountOfPrevious No/Ref], Right([Date of discovery],2) & "/" & Mid([date of discovery],4,2) AS [Date], QCount_for_chart.[Date of Discovery]
FROM QCount_for_chart
GROUP BY QCount_for_chart.[Type of Breach], QCount_for_chart.[Previous No/Ref], Right([Date of discovery],2) & "/" & Mid([date of discovery],4,2), QCount_for_chart.[Date of Discovery]
HAVING (((QCount_for_chart.[Date of Discovery])>=DateAdd("m",-7,Date())) AND ((Mid([Date of Discovery],4,2))<Right("0" & Month(Date()),2) And (Mid([Date of Discovery],4,2))>=Right("0" & Month(Date())-6,2)))
ORDER BY Right([Date of discovery],2) & "/" & Mid([date of discovery],4,2) DESC;
what is wrong with this query??
HELP much appreciated
SELECT QCount_for_chart.[Type of Breach], QCount_for_chart.[Previous No/Ref], Count(QCount_for_chart.[Previous No/Ref]) AS [CountOfPrevious No/Ref], Right([Date of discovery],2) & "/" & Mid([date of discovery],4,2) AS [Date], QCount_for_chart.[Date of Discovery]
FROM QCount_for_chart
GROUP BY QCount_for_chart.[Type of Breach], QCount_for_chart.[Previous No/Ref], Right([Date of discovery],2) & "/" & Mid([date of discovery],4,2), QCount_for_chart.[Date of Discovery]
HAVING (((QCount_for_chart.[Date of Discovery])>=DateAdd("m",-7,Date())) AND ((Mid([Date of Discovery],4,2))<Right("0" & Month(Date()),2) And (Mid([Date of Discovery],4,2))>=Right("0" & Month(Date())-6,2)))
ORDER BY Right([Date of discovery],2) & "/" & Mid([date of discovery],4,2) DESC;