MySQL Forums
Forum List  »  Oracle

Sum and Total Query
Posted by: priya siva
Date: June 06, 2007 09:57AM

Hi,
I'm new to mysql. I've a table in which I've 'domain name', 'number of email addresses', and 'date'. I need to find the top 10 domains by count sorted by percentage growth of the last 30 days compared to the total. Can any one please let me know the query ?

I've tried the below query, but it seems that it is incorrect.

SELECT domain_name, SUM(num_of_mailing_addr),(SUM(num_of_mailing_addr)/SUM(SUM(num_of_mailing_addrt)) * 100 ) AS percentage_growth FROM domain_mail_count WHERE date BETWEEN (CURRENT_DATE()-30) AND CURRENT_DATE() GROUP BY domain_name ORDER BY percentage_growth DESC LIMIT 10;

Thanks in advance
priya

Options: ReplyQuote


Subject
Views
Written By
Posted
Sum and Total Query
4823
June 06, 2007 09:57AM


Sorry, you can't reply to this topic. It has been closed.

Content reproduced on this site is the property of the respective copyright holders. It is not reviewed in advance by Oracle and does not necessarily represent the opinion of Oracle or any other party.