What I'm trying to do is so simple but I'm missing something.
I want to get a report to track patient's pain level and list when it's increasing. I want rows where pain level is greater than the first observation.
The table:
PatID Date Pain
1 01/1/01 6
1 02/1/01 4
1 03/1/01 7 *report this line
2 01/1/01 6
2 02/1/01 7 *report this line
2 03/1/01 4
2 04/1/01 8 *report ths line
I want to list ID, date, pain level, first pain level.
Would I:
Select a.PatID, A.Date, A.Pain, First(A.Pain)
from DB1 a
where a.pain >
(Select FIRST(Pain) from DB1 b
where a.PatID = b.PatID
order by b.PatID, B.Date
group by b.PatID)
?
Thank you.
I want to get a report to track patient's pain level and list when it's increasing. I want rows where pain level is greater than the first observation.
The table:
PatID Date Pain
1 01/1/01 6
1 02/1/01 4
1 03/1/01 7 *report this line
2 01/1/01 6
2 02/1/01 7 *report this line
2 03/1/01 4
2 04/1/01 8 *report ths line
I want to list ID, date, pain level, first pain level.
Would I:
Select a.PatID, A.Date, A.Pain, First(A.Pain)
from DB1 a
where a.pain >
(Select FIRST(Pain) from DB1 b
where a.PatID = b.PatID
order by b.PatID, B.Date
group by b.PatID)
?
Thank you.