B
Bill
Hi All:
Access 2000, Win98SE.
Crosstab 14 day report problem.
I have a 31 day report working as desired.
(Thanks to Duane Hookom)
I am attempting to convert the sql into a 14 day period.
Everything is good, except I am getting a separate line
in the report for every visit made to a patient (E X D).
I need to display visits to a specific patient, by the specific therapist,
from a specific company, on the same line. This was being achieved
in the 31 day report. I am posting both SQL views.
Thanks for your assistance.
Bill
SQL VIEW OF 14 DAY:
TRANSFORM First(qryVisitsandRateType2Wk.RateType) AS FirstOfRateType
SELECT qryVisitsandRateType2Wk.TherFullName,
qryVisitsandRateType2Wk.PtFullName, qryVisitsandRateType2Wk.CoFullName,
Count(qryVisitsandRateType2Wk.RateType) AS Total, Sum(Abs([RateType]="O"))
AS TotalOs, Sum(Abs([RateType]="CS")) AS TotalCS, Sum(Abs([RateType]<>"O"
And [RateType]<>"CS")) AS TotalEXDs
FROM qryVisitsandRateType2Wk
GROUP BY qryVisitsandRateType2Wk.TherFullName,
qryVisitsandRateType2Wk.PtFullName, qryVisitsandRateType2Wk.CoFullName,
qryVisitsandRateType2Wk.RateAmt, qryVisitsandRateType2Wk.VisitDate
PIVOT "Day" & DateDiff("d",[VisitDate],[EndDate]) In
("Day0","Day1","Day2","Day3","Day4","Day5","Day6","Day7","Day8","Day9","Day1
0","Day11","Day12","Day13");
SQL VIEW OF 31 DAY:
TRANSFORM First(qryVisitsandRateType.RateType) AS FirstOfRateType
SELECT qryVisitsandRateType.TherFullName, qryVisitsandRateType.PtFullName,
qryVisitsandRateType.CoFullName, Count(qryVisitsandRateType.RateType) AS
Total, Sum(Abs([RateType]="O")) AS TotalOs, Sum(Abs([RateType]="CS")) AS
TotalCS, Sum(Abs([RateType]<>"O" And [RateType]<>"CS")) AS TotalEXDs
FROM qryVisitsandRateType
GROUP BY qryVisitsandRateType.TherFullName, qryVisitsandRateType.PtFullName,
qryVisitsandRateType.CoFullName, qryVisitsandRateType.RateAmt,
Format([VisitDate],"dd") In
("01","02","03","04","05","06","07","08","09","10","11","12","13","14","15",
"16","17","18","19","20","21","22","23","24","25","26","27","28","29","30","
31")
PIVOT Format([VisitDate],"dd") In
("01","02","03","04","05","06","07","08","09","10","11","12","13","14","15",
"16","17","18","19","20","21","22","23","24","25","26","27","28","29","30","
31");
PS The original SQL from Duane did not have two "In" lines, but I could not
get the query to save without changing the column heading from "expression"
to "group by".
Access 2000, Win98SE.
Crosstab 14 day report problem.
I have a 31 day report working as desired.
(Thanks to Duane Hookom)
I am attempting to convert the sql into a 14 day period.
Everything is good, except I am getting a separate line
in the report for every visit made to a patient (E X D).
I need to display visits to a specific patient, by the specific therapist,
from a specific company, on the same line. This was being achieved
in the 31 day report. I am posting both SQL views.
Thanks for your assistance.
Bill
SQL VIEW OF 14 DAY:
TRANSFORM First(qryVisitsandRateType2Wk.RateType) AS FirstOfRateType
SELECT qryVisitsandRateType2Wk.TherFullName,
qryVisitsandRateType2Wk.PtFullName, qryVisitsandRateType2Wk.CoFullName,
Count(qryVisitsandRateType2Wk.RateType) AS Total, Sum(Abs([RateType]="O"))
AS TotalOs, Sum(Abs([RateType]="CS")) AS TotalCS, Sum(Abs([RateType]<>"O"
And [RateType]<>"CS")) AS TotalEXDs
FROM qryVisitsandRateType2Wk
GROUP BY qryVisitsandRateType2Wk.TherFullName,
qryVisitsandRateType2Wk.PtFullName, qryVisitsandRateType2Wk.CoFullName,
qryVisitsandRateType2Wk.RateAmt, qryVisitsandRateType2Wk.VisitDate
PIVOT "Day" & DateDiff("d",[VisitDate],[EndDate]) In
("Day0","Day1","Day2","Day3","Day4","Day5","Day6","Day7","Day8","Day9","Day1
0","Day11","Day12","Day13");
SQL VIEW OF 31 DAY:
TRANSFORM First(qryVisitsandRateType.RateType) AS FirstOfRateType
SELECT qryVisitsandRateType.TherFullName, qryVisitsandRateType.PtFullName,
qryVisitsandRateType.CoFullName, Count(qryVisitsandRateType.RateType) AS
Total, Sum(Abs([RateType]="O")) AS TotalOs, Sum(Abs([RateType]="CS")) AS
TotalCS, Sum(Abs([RateType]<>"O" And [RateType]<>"CS")) AS TotalEXDs
FROM qryVisitsandRateType
GROUP BY qryVisitsandRateType.TherFullName, qryVisitsandRateType.PtFullName,
qryVisitsandRateType.CoFullName, qryVisitsandRateType.RateAmt,
Format([VisitDate],"dd") In
("01","02","03","04","05","06","07","08","09","10","11","12","13","14","15",
"16","17","18","19","20","21","22","23","24","25","26","27","28","29","30","
31")
PIVOT Format([VisitDate],"dd") In
("01","02","03","04","05","06","07","08","09","10","11","12","13","14","15",
"16","17","18","19","20","21","22","23","24","25","26","27","28","29","30","
31");
PS The original SQL from Duane did not have two "In" lines, but I could not
get the query to save without changing the column heading from "expression"
to "group by".