i need to do the next thing:
For every record id need to return the FIRST date in which the record value has been increased/decreased by over 10% from it's last value (to that id).
If no increase/decrease by over 10% to that record id has happened i should ignore that record id.
for example for the next table
id record_date record_value
1 01/03/2008 100
1 23/04/2008 105
1 25/04/2008 130
2 10/04/2008 250
1 30/05/2008 200
2 30/05/2008 100
3 01/04/2008 150
i should return:
id record_date record value
1 25/04/2008 130
2 30/05/2008 100
this requires me to somehow use sub queries in away im not yet experienced with.
any help will be appreciated
For every record id need to return the FIRST date in which the record value has been increased/decreased by over 10% from it's last value (to that id).
If no increase/decrease by over 10% to that record id has happened i should ignore that record id.
for example for the next table
id record_date record_value
1 01/03/2008 100
1 23/04/2008 105
1 25/04/2008 130
2 10/04/2008 250
1 30/05/2008 200
2 30/05/2008 100
3 01/04/2008 150
i should return:
id record_date record value
1 25/04/2008 130
2 30/05/2008 100
this requires me to somehow use sub queries in away im not yet experienced with.
any help will be appreciated