update columns

Collapse
X
 
  • Time
  • Show
Clear All
new posts
  • blade_in_exile
    New Member
    • Aug 2006
    • 12

    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
  • masdi2t
    New Member
    • Jul 2006
    • 37

    #2
    yo can write an after insert trigger on 'results' table which is update your 'team' table.
    but, you must use at least mysql5.x

    Comment

    Working...