Two quick questions

PHP programming forum. Ask questions or help people concerning PHP code. Don't understand a function? Need help implementing a class? Don't understand a class? Here is where to ask. Remember to do your homework!

Moderator: General Moderators

Post Reply
noah_xumin
Forum Newbie
Posts: 3
Joined: Wed Dec 23, 2009 10:08 am

Two quick questions

Post by noah_xumin »

Q 1: Let us say I have 2 servers. Server 1 gave me a average_time value and Server 2 gave me another average_time value. How can I make the average number from these 2 servers/values and let the database put the average value into Server 1's average time slot and Server 2's average time slot

Q 2:I have a couple of server_id with the same value. How can I write a PHP/SQL script to sum the server_id number with the same value ?

Thank you so much for your help!

- Noah
User avatar
requinix
Spammer :|
Posts: 6617
Joined: Wed Oct 15, 2008 2:35 am
Location: WA, USA

Re: Two quick questions

Post by requinix »

What are you talking about?
User avatar
manohoo
Forum Contributor
Posts: 201
Joined: Wed Dec 23, 2009 12:28 pm

Re: Two quick questions

Post by manohoo »

I am a little confused about what you are trying to accomplish. Just remember that from a mathematical point of view you can't average averages. Does this make sense?

In other words, if you have these 2 averages, avg1 = 10, and avg2 = 20, you can't safely conclude that the average of the 2 is 15.

You have to know the population of each average, that is:

TotalAvg = (hits1 + hits2 ) / (pop1 + pop2)
Post Reply