I have been trying to use 'user variables' to keep
track of the previous row for use in a calculation of
the present row. Is there a way I can do this? Or
is there a better way in trying to use a previous
rows value in the present row.
For example;
SELECT number as current_day, (number -
Jasmin,
Thursday, May 02, 2002, 5:00:14 PM, you wrote:
JB I have been trying to use 'user variables' to keep
JB track of the previous row for use in a calculation of
JB the present row. Is there a way I can do this? Or
JB is there a better way in trying to use a previous
JB rows value in the
Hi,
Jasmin Bertovic wrote:
cut
For example;
SELECT number as current_day, (number - prevnumber)
as change_from_prev_day FROM TABLE ORDER BY DATE
prevnumber is the reference that I need from the
previous row.
Am I missing something simple or do I have to do this
outside of MYSQL?
1. Yes you
This makes sence, now that I have had some time to
think about it. If I self join, I have to make sure
that my data is continuous to shift all the rows by 1.
Some of the things could have missing dates or maybe
I could self join on an incremental counter using a
tmp table. I have do go back to