Dear All,
Figuring out a title for this question was hard, but the following is harder for me. I hope anyone can help.
I have a simple MySQL database table. This table is filled with records containing an ID and the number of week-visitors. It has records of 2 year of about 200+ websites.
To summarize, I want to be able to know two things:
1.) - "In week 54 of 2009 the website somethingonline.com had 300 visitors" (Easy of course. I can do this)
2.) - "The webiste sometingonline.com was among the 8% best scoring websites in that week."
Now, how can I get number 2.??? Of course, I want to know that percentage of all websites in every week so I get a list like:
- sometingonline1.com - 300 visitors - 8% of the website score like this or better
- sometingonline2.com - 400 visitors - 4% of the website score like this or better
- sometingonline3.com - 500 visitors - 2% of the website score like this or better
- sometingonline4.com - 600 visitors - 1% of the website score like this or better
How can I get these results? Is this possible in one query?
I use MySQL and PHP.