10-26-11, 19:40 #1Registered User
- Join Date
- Oct 2011
Unanswered: How to create a VIEW selecting data from multiple tables for a ranged time interval
I have the Tables Patient, Doctor, Treatment, Pat_Doc_Treat, and Schedule.
Patient(patientNumb, SS, name, dateOfBirth, address, dateAdmitted, clinic)
Doctor(doctorID, name, pagerNumb)
Pat_Doc_Treat(patientNumb, doctorID, treatmentCode, date, comments)
Schedule(doctorID, date, clinic, numbOfWorkHours)
The task is:
A doctor, including the doctor's ID, name, and number of patients treated by the doctor in the clinic for a given date interval.
My question is:
How do you create a VIEW to select certain data from multiple tables for a ranged time interval?
I tried creating this view:
CREATE VIEW V_Doc AS SELECT d.doctor.ID, d.name, count(pdt.*) FROM Doctor d, Pat_Doc_Treat pdt WHERE d.doctorID=pdt.doctorID AND pdt.treatmentCode AND pdt.date IN(SELECT date FROM Schedule);
Is it better to write a stored procedure for this or is a view able to fulfill my question?
10-26-11, 19:50 #2Registered User
Provided Answers: 1
- Join Date
- Aug 2003
- Where the Surf Meets the Turf @Del Mar, CA
>Is it better to write a stored procedure for this or is a view able to fulfill my question?
Which metric at what value quantifies better?
Last edited by anacedent; 10-26-11 at 19:57.You can lead some folks to knowledge, but you can not make them think.
The average person thinks he's above average!
For most folks, they don't know, what they don't know.
Good judgement comes from experience. Experience comes from bad judgement.