I have two tables Visits and Labs
Visit has these fields: id,patientID
Labs has these fields: id, VisitID
And Visit.id = Labs.VisitID
I want to get all old lab reports of a patient. But in lab table I don’t have patientID field,
so for that I need to make use of visitID field, using which I can connect to Visit table and there I have patientID
So now using visitID(a common field) I want to find out all old lab reports of a patient
Now I want to get all labs of a patient (I know patientID)
Can anyone suggest me join query for this?
It’s a simple
INNER JOIN, right?Or you can do a subselect: