Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations Westi on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

Help averaging data

Status
Not open for further replies.

james0816

Programmer
Jan 9, 2003
295
US
I'm not sure about the best way to do this so here goes. First, I have retrieved from my database only certain records:

$result2 = mysql_query("SELECT * FROM results where dcode=$dname and yr=$lyr", $connection);

we'll keep it short by only listing a few records:

a b c
20 12 257
16 8 312
32 40 118


now...here's where it is getting tricky for me.

I want to display averages for a and b and a total for c. to complicate it, i also want to count the number for b that is under 10.

so my display should be something to the effect of:

a b c d
22.7 20 687 1 <- D represents one row under 10

is there an easy of doing this or am i going to have to write individual queries for each item i am trying to display?

thx
 
sry....coding in PHP which lead me to here....thx
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top