I have a query that tells me the number of reviews conducted by each team in my organization. It gives me the total for each team including a value of zero for teams that did none. This is what I want. Here is the query:
SELECT Team_Inf
peration, Team_Info.Department, Team_Info.TeamIDRS, Count(AgeReview.TeamIDRS) AS CountOfTeamIDRS
FROM AgeReview RIGHT JOIN Team_Info ON AgeReview.TeamIDRS = Team_Info.TeamIDRS
GROUP BY Team_Inf
peration, Team_Info.Department, Team_Info.TeamIDRS
ORDER BY Team_Inf
peration, Team_Info.Department, Team_Info.TeamIDRS;
Now, my only problem is that it gives me a count of all the reviews in the DB. I want to get results on a weekly basis. So, I added to the end of the SQL this: WHERE AgeReview.ReviewDate Between Date() AND Date()-7
This query worked but did a couple of things to the results that I don't want it to do. First, it no longer returned zero values. Second, if a team did 2 reviews on one day of the week and 2 on another, it gave me two results for that team, instead of one. Meaning, it would give me one row that said Team 405 Count 2 and then a second row that said the same when what I want is simply one row that says Team 405 Count 4.
How can I add a date parameter without changing the results that are returned?
SELECT Team_Inf
FROM AgeReview RIGHT JOIN Team_Info ON AgeReview.TeamIDRS = Team_Info.TeamIDRS
GROUP BY Team_Inf
ORDER BY Team_Inf
Now, my only problem is that it gives me a count of all the reviews in the DB. I want to get results on a weekly basis. So, I added to the end of the SQL this: WHERE AgeReview.ReviewDate Between Date() AND Date()-7
This query worked but did a couple of things to the results that I don't want it to do. First, it no longer returned zero values. Second, if a team did 2 reviews on one day of the week and 2 on another, it gave me two results for that team, instead of one. Meaning, it would give me one row that said Team 405 Count 2 and then a second row that said the same when what I want is simply one row that says Team 405 Count 4.
How can I add a date parameter without changing the results that are returned?