I have three tables called Clinic
, Doctor
, and Clinic_has_Doctor
. Suppose the two tables Clinic
and Doctor
have fields id
and name
as follows:
Clinic
+----+------------------------+
| id | name |
+----+------------------------+
Doctor
+----+------------------------+
| id | name |
+----+------------------------+
And Clinic_has_Doctor
is a simple table containing mappings between clinics and doctors:
Clinic_has_Doctor
+-----------+-----------------+
| Clinic_id | Doctor_id |
+-----------+-----------------+
which expectedly are foreign keys to Clinic
and Doctor
IDs. I need to get the list of clinics and the doctors along them. So I would have a table like:
+-----------+--------------+------------+--------------+
| Clinic_id | Clinic_name | Doctor_id | Doctor_name |
+-----------+--------------+------------+--------------+
I haven't done much JOIN
SQL commands so I couldn't get out of this. Any help?