Hi,
I have a table that has a record each time a road gets patrolled. I have another table, that has all of the roads. I also have a query that tells me how many times a road was patrolled in a week.
What I want to do is get a list of all road patrols for the current week for all roads, but I also want the roads with no (ie. 0) patrols to show up also. If there is 1 or more, they show up, but how do I get the roads that have 0 patrols to show up.
Here is my SQL from the designer in MS Access:
SELECT tblREGIONAL_ROADS.REG_RD, tblREGIONAL_ROADS.REG_RD_NUM, tblREGIONAL_ROADS.Depot, qryRoadPatrolsByWeek.Expr1 AS [Current Week], qryRoadPatrolsByWeek.[Count of Road Patrols this Week]
FROM tblREGIONAL_ROADS LEFT JOIN qryRoadPatrolsByWeek ON tblREGIONAL_ROADS.REG_RD_NUM = qryRoadPatrolsByWeek.ROADNUM
WHERE (((tblREGIONAL_ROADS.Depot)="Ajax/Pickering") AND ((qryRoadPatrolsByWeek.Expr1)=DatePart("ww",Now())));
My qryRoadPatrolsByWeek basically just summarizes the # of patrols for each week....it groups and then does a count to get the [Count of Road Patrols this Week].
Obvioulsy the roads with a count of 0 aren't going to show up in the qryRoadPatrolsByWeek, since they won't be in the table. But ALL of the roads are in the tblREGIONAL_ROADS, so how do I get a record to show up in the final query that shows a count of 0.
Thanks,
I have a table that has a record each time a road gets patrolled. I have another table, that has all of the roads. I also have a query that tells me how many times a road was patrolled in a week.
What I want to do is get a list of all road patrols for the current week for all roads, but I also want the roads with no (ie. 0) patrols to show up also. If there is 1 or more, they show up, but how do I get the roads that have 0 patrols to show up.
Here is my SQL from the designer in MS Access:
SELECT tblREGIONAL_ROADS.REG_RD, tblREGIONAL_ROADS.REG_RD_NUM, tblREGIONAL_ROADS.Depot, qryRoadPatrolsByWeek.Expr1 AS [Current Week], qryRoadPatrolsByWeek.[Count of Road Patrols this Week]
FROM tblREGIONAL_ROADS LEFT JOIN qryRoadPatrolsByWeek ON tblREGIONAL_ROADS.REG_RD_NUM = qryRoadPatrolsByWeek.ROADNUM
WHERE (((tblREGIONAL_ROADS.Depot)="Ajax/Pickering") AND ((qryRoadPatrolsByWeek.Expr1)=DatePart("ww",Now())));
My qryRoadPatrolsByWeek basically just summarizes the # of patrols for each week....it groups and then does a count to get the [Count of Road Patrols this Week].
Obvioulsy the roads with a count of 0 aren't going to show up in the qryRoadPatrolsByWeek, since they won't be in the table. But ALL of the roads are in the tblREGIONAL_ROADS, so how do I get a record to show up in the final query that shows a count of 0.
Thanks,