OuterApply
New member
- Local time
- Today, 02:37
- Joined
- Mar 10, 2022
- Messages
- 15
I'm going to have a dataset in a temp table with columns:
PatientID (varchar)
LabValue (float)
CollectionDateTime (datetime)
A patient ID may repeat 1, 5, or 100 times in this table, with various collection dates and lab values.
I need to end up with the following information:
For each distinct patient ID, I need to determine (Y/N) whether or not at any point in time, the LabValue increased by .3 in 48 hours or 50% in 7 days.
I'm pretty confident I can figure out how to do this with a cursor or two and a loop.
However, I'm wondering if there is any super ultra brilliant person who can think of a way to do it set-based & no loop etc. If so I will be very impressed thank you!
PatientID (varchar)
LabValue (float)
CollectionDateTime (datetime)
A patient ID may repeat 1, 5, or 100 times in this table, with various collection dates and lab values.
I need to end up with the following information:
For each distinct patient ID, I need to determine (Y/N) whether or not at any point in time, the LabValue increased by .3 in 48 hours or 50% in 7 days.
I'm pretty confident I can figure out how to do this with a cursor or two and a loop.
However, I'm wondering if there is any super ultra brilliant person who can think of a way to do it set-based & no loop etc. If so I will be very impressed thank you!