Pages

MySQL Inner Join

TABLES
Hospital
Bed
Patient

We know patient id; when we need to get patient name and bed number.

QUERY
SELECT h.id,p.name,b.number FROM hospital AS h
INNER JOIN patient as p ON p.id=h.patient_id
INNER JOIN bed as b ON b.id=h.bed_id
WHERE
h.patient_id=1

No comments:

Post a Comment