472,145 Members | 1,487 Online
Bytes | Software Development & Data Engineering Community
Post +

Home Posts Topics Members FAQ

Join Bytes to post your question to a community of 472,145 software developers and data experts.

update columns

hi all

my query is either going to be so simple i should of seen the answer myself or tax everyone trying to get the answer so here goes

i have a database that holds records for football teams

one table is set up so
team_id
team
for
against
goal_diff
points

now what i would like to do is have the goal_diff column update automatically when the scores are inputted on another table which holds results

i have the for and against columns filling ok i was wondering what the best way of filling goal_diff was

would it be a code written into the sql doc itself or would it be better done when the whole thing is outputted to a php page for viewing, this way would cut down on columns although speed is not essential in this operation as there are only ever 20 teams in this table.

Regards
Aug 4 '06 #1
1 1552
masdi2t
37
yo can write an after insert trigger on 'results' table which is update your 'team' table.
but, you must use at least mysql5.x
Aug 5 '06 #2

Post your reply

Sign in to post your reply or Sign up for a free account.

Similar topics

16 posts views Thread by robert | last post: by
2 posts views Thread by Christos Kalantzis | last post: by
1 post views Thread by binder | last post: by
5 posts views Thread by explode | last post: by
2 posts views Thread by L.Peter | last post: by
3 posts views Thread by Michel Esber | last post: by
reply views Thread by Saiars | last post: by
reply views Thread by leo001 | last post: by

By using Bytes.com and it's services, you agree to our Privacy Policy and Terms of Use.

To disable or enable advertisements and analytics tracking please visit the manage ads & tracking page.