Unanswered: set variable and calculate % change between different lines
hi everybody,i'm new here and in mysql world...trying to learn something new everyday. I'm working on a bi platform based on mysql reports and i have a problem with one of them.
I want the report to tell me sales of a shop by year and month and i want to calculate the change between sales of the months. For example
shop year month sales diff
142 2015 may 11.000 +10%
142 2015 abr 10.000 ....
I tried to set a variable (@prev_val) but when i execute the query it gives an error.
If somebody could help me...
Thanks in advance