Posted on 2014-02-18
Using MS SQL Server 2008.
I have a table of Measurements which represent measurements made on patients over a number of visits.
The relevant columns are:
pat_id (int) - identifies the patient
visitdate (date) - the date of the visit
value (int) - the measured value
I need to produce a query that has all a patients visits and measured values in the same row, one row per patient:
pat_id, visitdate 1, value 1, visitdate 2, value 2, visitdate 3, value 3 .... etc
I can not say for certain how many visits a patient has made. Probably 4 or 5 but as time passes the number will increase.
Can design me a solution?