G
Guest
I am tracking a variable for different subjects over time. I want to find the
value and date of the FIRST LOCAL MINIMUM for each subject.
Here are some sample data:
ID --- Value ---- Date
=========================
1 ----- 9.0 ----- 1/10/03
1 ----- 5.0 ----- 1/10/04
1 ----- 1.0 ----- 1/10/05
1 ----- 0.5 ----- 1/10/06
1 ----- 2.0 ----- 3/10/06
1 ----- 0.5 ----- 3/12/06
1 ----- 0.1 ----- 3/20/06
2 ----- 3.0 ----- 1/10/01
2 ----- 1.0 ----- 1/10/02
2 ----- 1.0 ----- 3/10/02
2 ----- 2.0 ----- 6/10/02
2 ----- 0.5 ----- 6/10/03
I want a query that will give the following results:
ID --- Value ---- Date
==========================
1 ----- 0.5 ----- 1/10/06
2 ----- 1.0 ----- 1/10/02
Can this be done with SQL alone, or is a recursive or array script needed?
I could write a script in PHP, but I'm trying to do this in a stand-alone
desktop Access database and need some help getting started with VBA scripting
if that's what needs to be done. Thanks!
value and date of the FIRST LOCAL MINIMUM for each subject.
Here are some sample data:
ID --- Value ---- Date
=========================
1 ----- 9.0 ----- 1/10/03
1 ----- 5.0 ----- 1/10/04
1 ----- 1.0 ----- 1/10/05
1 ----- 0.5 ----- 1/10/06
1 ----- 2.0 ----- 3/10/06
1 ----- 0.5 ----- 3/12/06
1 ----- 0.1 ----- 3/20/06
2 ----- 3.0 ----- 1/10/01
2 ----- 1.0 ----- 1/10/02
2 ----- 1.0 ----- 3/10/02
2 ----- 2.0 ----- 6/10/02
2 ----- 0.5 ----- 6/10/03
I want a query that will give the following results:
ID --- Value ---- Date
==========================
1 ----- 0.5 ----- 1/10/06
2 ----- 1.0 ----- 1/10/02
Can this be done with SQL alone, or is a recursive or array script needed?
I could write a script in PHP, but I'm trying to do this in a stand-alone
desktop Access database and need some help getting started with VBA scripting
if that's what needs to be done. Thanks!