|
Neohapsis is currently accepting applications for employment. For more information, please visit our website www.neohapsis.com or email hr@neohapsis.com |
From: kabel (lists
voidship.net)
Date: Tue May 06 2008 - 12:46:20 CDT
- Messages sorted by: [ date ] [ thread ] [ subject ] [ author ]
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
- Messages sorted by: [ date ] [ thread ] [ subject ] [ author ]