SELECT vis.Patient_Name, count(vis.Doctor_Name) AS Number_Of_Doctors, (select count(Doctor_Specialty) from Doctors inner join Visits on Doctors.Doctor_Name = Visits.Doctor_Name where Visits.Patient_Name = Vis.Patient_Name group by Visits.Patient_Name) AS Number_Of_Specialities FROM VISITS AS Vis GROUP BY vis.Patient_Name;Which doesn't seem to be correct. E.g. I have a patient who went to 3 doctors, two of them have the same specialty. I'm expecting to see
Name #Doctors #Specialties Patient1 3 2but instead I see