Percentage growth query.
- Date: Tue, 6 May 2008 13:46:20 -0400
- From: kabel <lists@xxxxxxxxxxxx>
- Subject: Percentage growth query.
I have a table from which I need to calculate the percentage growth of
downloads from specific countries over two distinct periods of time.
Calculating the total downloads from a country over one period of time is not
difficult:
SELECT country, SUM(total_dl) AS q3_total FROM show_history WHERE year = 2007
AND ( month = 12 OR month = 11 OR month = 10 ) GROUP BY (country);
I need to be able to compare those numbers with the result of:
SELECT country, SUM(total_dl) AS q4_total FROM show_history WHERE year = 2007
AND ( month = 10 OR month = 11 OR month = 12 ) GROUP BY (country);
I'm currently using temporary tables to store the results of each query,
however, I think there's a way to accomplish this using subqueries.
Any thoughts?
TIA,
kabel
--
MySQL General Mailing List
For list archives: http://lists.mysql.com/mysql
To unsubscribe: http://lists.mysql.com/mysql?unsub=royale@xxxxxxxxxx