Използвайте Групиране по временна таблица с отделни пациент и лекар
select Patient, count(*)
from (
select distinct Bookings.PatientID as Patient ,DoctorID as Doctors
from Bookings ) as t
Group by Patient;
Използвайте Групиране по временна таблица с отделни пациент и лекар
select Patient, count(*)
from (
select distinct Bookings.PatientID as Patient ,DoctorID as Doctors
from Bookings ) as t
Group by Patient;