Posted on 2015-02-22
MS SQL Server 2008!
I have three database tables that record data regarding patient visits. The tables hold data from different departments and are different in number of columns and content.
However there are three columns that hold the same type of information in the three tables. These three columns are PatientId, VisitDate and Height.
I have been asked to produce a query that returns the Height of the patient on their latest visit.
So I need to find the row for each patient in the three tables, identify the latest record using VisitDate and take the value of Height.
The three tables are Hospital, Clinic, and Doctor.
The three columns that are identical are:
Can someone suggest a query or a solution? I just can’t seem to get my head round it!