Posted 30 January 2003 - 06:18 PM
I have a picture, maybe it\'ll explain it better.
I would like the \"webave\" column to contain the averages of \"info\" and \"design\" columns.
and I\'d like the \"totalave\" column to contain the average of \"skill\", \"activity\", \"pedi\" and \"webave\" columns.
Is that even possible?
I\'m a newbie at this database stuff so please be easy :?
Posted 31 January 2003 - 01:38 AM
Posted 31 January 2003 - 04:39 AM
The skill, activity, pedi, info and design values will be inserted from outside and when they are inserted I want mysql to input the average in the right column.
I looked around and saw that there\'s an average function in mysql but with my low mysql skills I don\'t know how to use it.
Posted 31 January 2003 - 11:19 AM
INSERT (\'Start\' = 5, \'End\' = 8, \'Distance\' = (End-Start)
(this is pseudo pseudo sql... check the correct synax in the manual):
Here\'s a little help from the manual:
# An expression may refer to any column that was set earlier in a value list. For example, you can say this: mysql> INSERT INTO tbl_name (col1,col2) VALUES(15,col1*2);
Check the syntax:
Posted 31 January 2003 - 05:20 PM
Posted 02 February 2003 - 01:47 AM
SELECT AVG(var1) , AVG(var2) FROM table
<?php str_replace("ASP", "PHP", $str); ?>
Posted 03 February 2003 - 02:45 PM
Hmm, what do you mean by inserting the values before the calculations?
I meant that in the VERY SAME statement you must specify the values first and then the calculations after...
insert into blabla (col1, col2, col3) values (4,4, average(col1, col2));
0 user(s) are reading this topic
0 members, 0 guests, 0 anonymous users