User Variables and Previous Row Question

2002-05-02 Thread Jasmin Bertovic
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 -

Re: User Variables and Previous Row Question

2002-05-02 Thread Victoria Reznichenko
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

Re: User Variables and Previous Row Question

2002-05-02 Thread Alexander Keremidarski
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

Re: User Variables and Previous Row Question

2002-05-02 Thread Jasmin Bertovic
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