Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations gkittelson on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

Summarize patients' quarterly visits and charges using a select query 1

Status
Not open for further replies.

jane30

Programmer
Nov 14, 2000
92
US
Hi, All!
Currently the records in my database are listed by yearmonth, group by hospital, departments like the following:
yearmonth hopital dept visits charges
200007 HospitalA Depta 1,000 $2,000
200007 HospitalA Deptb 500 $1,120
200007 HospitalA Deptc 20 $550
200008 HospitalA Depta 5,365 $122,000
200008 HospitalA Deptb 970 $10,670
200008 HospitalA Deptc 103 $1,853
when user enters "200007"(startper) , " 200008"(endper) in the form, I want to use the entered value as my criteria of selecting records and summary 200007 data and 200008 data, group by hopital and dept:

HospitalA Depta 6,365 $124,000
HospitalA Deptb 1470 $11,790
HospitalA Deptc 123 $2,403

Thanks a bunch in advance.
 

Create a query that looks like this one.

Select hospital, dept, Sum(visits) As VisitsSum, Sum(charges) As ChargesSum
From Table1
Where yearmonth Between forms!myform.startper And forms!myform.endper
Group By hospital, dept
Terry
------------------------------------
Blessed is the man who, having nothing to say, abstains from giving us worthy evidence of the fact. -George Eliot
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top