MYSQL PHP: How do I calculate percentage change from mysql table?
Posted on 2008-06-11
I have a MySQL table with 2 fields:
[ Date ] [ Value ]
I would like to calculate the percentage increase or decrease as at the last date (e.g. 2007-12-31), when compared to 1 month ago.
So in the example, I want to calculate (2200-2000) / 2000
How do I write this in a mysql query in a PHP script?