sqlplus - sql multiple attribute join -


i'm creating test database on medical practices. here picture of er diagram reference. er diagram

so question how joins properly. i'm trying give list of patients seen given practice (e.g practice id 1) want show practice name , details. want show list of patients , and gp's work or have been practice (keep in mind have populated tables 10 rows of test data)

i have got far

select patient.firstname, patient.surname patient join appointment on patient.patientid = appointment.patientid appointment.practiceid in (1) order firstname; 

`how include practice details , gp details associated practice. what's confusing me how add more select statements if not patient table. great!

you can add more join clauses:

select   patient.firstname, patient.surname, practice.name, practice.address     patient join     appointment on patient.patientid = appointment.patientid join     practice on appointment.practiceid = practice.practiceid    appointment.practiceid in (1) order firstname; 

Comments

Popular posts from this blog

Django REST Framework perform_create: You cannot call `.save()` after accessing `serializer.data` -

Why does Go error when trying to marshal this JSON? -