A
airnuminz
On the many side of a one-to-many, my many table looks something like
this:
(The " --- " is just to help you see when a new patient begins)
###
PatientID VisitNo VisitDate MonthsFromVisitZero
1 0 5/1/03 0
1 1 6/1/03 1
1 2 9/1/03 4
1 3 2/1/04 9
----
2 0 1/1/02 0
2 1 5/1/02 4
----
3 0 3/1/05 0
3 1 1/1/06 10
3 2 2/1/06 11
3 3 4/1/06 13
###
But MonthsFromVisitZero is currently blank (those are the values that
*should* be there). How can I create a query that calculates the value
for MonthsFromVisitZero. As I see it, for each visit, for each
patient, I need to subtract VisitDate from (VisitDate WHERE VisitNo =
0). I just can't figure out the syntax.
Thanks!
this:
(The " --- " is just to help you see when a new patient begins)
###
PatientID VisitNo VisitDate MonthsFromVisitZero
1 0 5/1/03 0
1 1 6/1/03 1
1 2 9/1/03 4
1 3 2/1/04 9
----
2 0 1/1/02 0
2 1 5/1/02 4
----
3 0 3/1/05 0
3 1 1/1/06 10
3 2 2/1/06 11
3 3 4/1/06 13
###
But MonthsFromVisitZero is currently blank (those are the values that
*should* be there). How can I create a query that calculates the value
for MonthsFromVisitZero. As I see it, for each visit, for each
patient, I need to subtract VisitDate from (VisitDate WHERE VisitNo =
0). I just can't figure out the syntax.
Thanks!