1

I'm using Microsoft SQL Management Studio 2012 and I'm trying to find a function to find the date difference within a string that is grouped by another field. Below the query is grouped by Encounter. There are multiple tests per patient encounter. How do I create another field with the date difference between the first and second record per Encounter number? How would I add the difference between the second and third record per Encounter?

Encounter Test ResultDTS 159593221 TROPONIN I 2013-01-21 17:32:00.000 159593221 TROPONIN I 2013-01-21 21:38:00.000 159593221 TROPONIN I 2013-01-22 00:57:00.000 159593221 TROPONIN I 2013-01-22 06:14:00.000 159593427 TROPONIN I,QUAL,POC 2013-01-21 17:57:00.000 159593675 TROPONIN I 2013-01-21 18:14:00.000 159593675 TROPONIN I 2013-01-22 00:44:00.000 159593675 TROPONIN I 2013-01-22 05:30:00.000 159593675 TROPONIN I 2013-01-22 11:12:00.000

0 Answers0