I have a pretty simple query that I wish to create, but I just haven't been able to do it. I'm really hoping that somebody can help.
I'm replacing the names of the tests that I actually want here, for security purposes... but let's suppose this is the scenario.
I'm analyzing patient's who have had a test called "PROCALCITONIN" performed. I only want to see the result for the first PROCALCITONIN test that a patient had performed. I also want to select the HEMOGLOBIN and GFR that the patient had most recently preceeding their first PROCALCITONIN test.
To make things easier, all of my information is in a single table. So let's suppose I have the following table with only 1 patient (of course, my actual table has thousands of patients) with the following information:
The first table is what I am starting with and the second table is the table I'd like to create with a query:
Patient ID Test Name Test Value Test Date 1 Procalcitonin 4 1/1/2013 1 Hemoglobin 11.3 12/30/2012 1 Procalcitonin 3.6 1/4/2013 1 GFR 60 1/3/2013 1 GFR 47 12/30/2012 1 GFR 58.3 12/26/2012 1 Hemoglobin 11.8 12/22/2012 1 Hemoglobin 11.2 1/7/2013 1 GFR 60 1/2/2013 1 Hemoglobin 11.8 12/28/2012 Patient ID Test Name Test Value Test Date 1 Procalcitonin 4 1/1/2013 1 GFR 47 12/30/2012 1 Hemoglobin 11.3 12/30/2012
Any information that anybody might be able to give me on how to pull this off would mean the world to me! Thanks so much!