K
knowshowrosegrows
OK, I have a crosstab query that you all helped me with that I love.
I have 72 programs that are supposed to report data every day. The crosstab
lets me choose a date range and then spits out the vacancy rate for each
program for each day in the range.
Program 1/1/08 1/2/08 1/3/08
prmX 72% 81% 88%
prmXX 77% 91%
The problem. If one of my programs did not report any data on any day in
the range - I do not get that program listed with blanks in all the date
fields. I need to have the table that is created by the crosstab joined
somehow with the program table so all the programs show up regardless of
whether they reported on each day of the range.
The sql I have for the crosstab is:
TRANSFORM Avg(qryVacancyRateTrendFirst.VacancyRate) AS VacancyRate
SELECT qryVacancyRateTrendFirst.Reg, qryVacancyRateTrendFirst.Agency,
qryVacancyRateTrendFirst.Location, qryVacancyRateTrendFirst.Cap,
qryVacancyRateTrendFirst.LOC_Alias, qryVacancyRateTrendFirst.Prm_Code,
Avg(qryVacancyRateTrendFirst.VacancyRate) AS [Average Of Vacancy Rate]
FROM qryVacancyRateTrendFirst
WHERE ((([qryVacancyRateTrendFirst.CensusDate]) Between
DateAdd("yyyy",-1,Date()) And Date()))
GROUP BY qryVacancyRateTrendFirst.OrderOfIntensity,
qryVacancyRateTrendFirst.Reg, qryVacancyRateTrendFirst.Agency,
qryVacancyRateTrendFirst.Location, qryVacancyRateTrendFirst.Cap,
qryVacancyRateTrendFirst.LOC_Alias, qryVacancyRateTrendFirst.Prm_Code
PIVOT Format([CensusDate],"mm-dd");
Is this clear enough for someone to help me?
I have 72 programs that are supposed to report data every day. The crosstab
lets me choose a date range and then spits out the vacancy rate for each
program for each day in the range.
Program 1/1/08 1/2/08 1/3/08
prmX 72% 81% 88%
prmXX 77% 91%
The problem. If one of my programs did not report any data on any day in
the range - I do not get that program listed with blanks in all the date
fields. I need to have the table that is created by the crosstab joined
somehow with the program table so all the programs show up regardless of
whether they reported on each day of the range.
The sql I have for the crosstab is:
TRANSFORM Avg(qryVacancyRateTrendFirst.VacancyRate) AS VacancyRate
SELECT qryVacancyRateTrendFirst.Reg, qryVacancyRateTrendFirst.Agency,
qryVacancyRateTrendFirst.Location, qryVacancyRateTrendFirst.Cap,
qryVacancyRateTrendFirst.LOC_Alias, qryVacancyRateTrendFirst.Prm_Code,
Avg(qryVacancyRateTrendFirst.VacancyRate) AS [Average Of Vacancy Rate]
FROM qryVacancyRateTrendFirst
WHERE ((([qryVacancyRateTrendFirst.CensusDate]) Between
DateAdd("yyyy",-1,Date()) And Date()))
GROUP BY qryVacancyRateTrendFirst.OrderOfIntensity,
qryVacancyRateTrendFirst.Reg, qryVacancyRateTrendFirst.Agency,
qryVacancyRateTrendFirst.Location, qryVacancyRateTrendFirst.Cap,
qryVacancyRateTrendFirst.LOC_Alias, qryVacancyRateTrendFirst.Prm_Code
PIVOT Format([CensusDate],"mm-dd");
Is this clear enough for someone to help me?