Hi guys. I have searched S.O. for this answer and have came close to an answer but still not close enough. I am interested in knowing if MySQL has this capability.
I have developed in Perl and MySQL 4 and I'm on MySQL 4 now. My table looks like this...
- symbol varchar(25)
- todayDate date
- interest int(11)
My problem is this.....these symbols (about 200,000 of them) update everyday with a new number for the interest field.
An example would be this....
symbol | todayDate | interest
-------------------------------
A202015 | 2010-10-26 | 150
A202015 | 2010-10-25 | 100
Ideally what I would be able to do would be to update another field at the end with a percentage change from the previous record. The above would then look like this....
symbol | todayDate | interest | change
-----------------------------------------
A202015 | 2010-10-26 | 150 | 50
A202015 | 2010-10-25 | 100
I didn't think that this functionality was possible in MySQL. I have come to the conclusion that I just need to grab the previous record info, do the math and then update the latest record with the percentage info. I just thought I would double check and see if any MySQL geniuses had any wisdom to pass my way.