Level Extreme platform
Subscription
Corporate profile
Products & Services
Support
Legal
Français
Access queries
Message
From
10/11/2005 12:41:46
 
General information
Forum:
Visual FoxPro
Category:
Databases,Tables, Views, Indexing and SQL syntax
Title:
Environment versions
Visual FoxPro:
VFP 9
OS:
Windows XP SP2
Database:
Visual FoxPro
Miscellaneous
Thread ID:
01066285
Message ID:
01067271
Views:
17
>Fabio,
>
>In your last reply you seem to be addressing different problem. Here is the problem we're having trouble with:
>
>For each patient in VISITS, give the patient's name, the number of doctors that the patient went to, and the number of different specialties.

>
>
SELECT Patient_Name,Doctor_Count,COUNT(*) Specialty_Count FROM 
	(SELECT DISTINCT V.Patient_Name,V.Doctor_Count,Doctors.Doctor_Specialty
	   ((SELECT V.Patient_Name,COUNT(*) Doctor_Count  FROM 
		(SELECT DISTINCT Patient_Name,Doctor_Name FROM Visits) V
	   		GROUP BY Patient_Name) V
		   JOIN Visits ON Visits.Patient_Name = V.Patient_Name)
	JOIN Doctors ON Doctors.Doctor_Name = Visits.Doctor_Name) V
	GROUP BY Patient_Name,Doctor_Count
Previous
Reply
Map
View

Click here to load this message in the networking platform