Sign Up

Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.

Have an account? Sign In

Have an account? Sign In Now

Sign In

Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.

Sign Up Here

Forgot Password?

Don't have account, Sign Up Here

Forgot Password

Lost your password? Please enter your email address. You will receive a link and will create a new password via email.

Have an account? Sign In Now

You must login to ask a question.

Forgot Password?

Need An Account, Sign Up Here

Please briefly explain why you feel this question should be reported.

Please briefly explain why you feel this answer should be reported.

Please briefly explain why you feel this user should be reported.

Sign InSign Up

The Archive Base

The Archive Base Logo The Archive Base Logo

The Archive Base Navigation

  • SEARCH
  • Home
  • About Us
  • Blog
  • Contact Us
Search
Ask A Question

Mobile menu

Close
Ask a Question
  • Home
  • Add group
  • Groups page
  • Feed
  • User Profile
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Buy Points
  • Users
  • Help
  • Buy Theme
  • SEARCH
Home/ Questions/Q 6755395
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 26, 20262026-05-26T13:23:41+00:00 2026-05-26T13:23:41+00:00

im trying to make an trigger that updates a table when i modify another

  • 0

im trying to make an trigger that updates a table when i modify another table…
Here is my code:

CREATE TRIGGER updpartido AFTER UPDATE ON partidos
ON EACH ROW
    BEGIN
        SET @vgls = SELECT vgoles(NEW.eqvis)
        SET @lgls = SELECT vgoles(NEW.eqloc)
        UPDATE equipos SET gf=@vgls WHERE id=NEW.eqvis
        UPDATE equipos SET gf=@lgls WHERE id=NEW.eqloc
    END

What it must do is, when i update an match, it must automaticly run this trigger and update the goals.

But it gives me an error.
What im doing wrong? Thanks and have a nice day…!

  • 1 1 Answer
  • 0 Views
  • 0 Followers
  • 0
Share
  • Facebook
  • Report

Leave an answer
Cancel reply

You must login to add an answer.

Forgot Password?

Need An Account, Sign Up Here

1 Answer

  • Voted
  • Oldest
  • Recent
  • Random
  1. Editorial Team
    Editorial Team
    2026-05-26T13:23:41+00:00Added an answer on May 26, 2026 at 1:23 pm

    I notice that you don’t have any statement terminators in your trigger, that will generate some complaints because, for example, SET @lgls = SELECT vgoles(NEW.eqloc) UPDATE equipos SET gf=@vgls WHERE id=NEW.eqvis doesn’t make any sense. So you need some semicolons in the trigger but you also need to get those semicolons past the parser by temporarily changing the delimiter. You’re also using ON EACH ROW when it should be FOR EACH ROW:

    delimiter |
    CREATE TRIGGER updpartido AFTER UPDATE ON partidos
    FOR EACH ROW
        BEGIN
            SET @vgls = SELECT vgoles(NEW.eqvis);
            SET @lgls = SELECT vgoles(NEW.eqloc);
            UPDATE equipos SET gf=@vgls WHERE id=NEW.eqvis;
            UPDATE equipos SET gf=@lgls WHERE id=NEW.eqloc;
        END;
    |
    delimiter ;
    
    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

I'm trying to make a trigger that updates a table, and here's some psuedo
Hi iam trying to make an update trigger in my database. But i get
DELIMITER $$ CREATE TRIGGER stock_empty AFTER UPDATE on products FOR EACH ROW DELETE FROM
Here is my code structure, that I saw from someone else and am trying
I'm trying to make a snippit that wraps some code around the code that
Good Day All we are trying to do is inside a trigger make sure
Trying to make a make generic select control that I can dynamically add elements
Trying to make a custom :confirm message for a rails form that returns data
I'm trying to create a dummy application that maintains a list of tasks. For
I am trying to make a self-managing partition table setup with Postgres. It all

Explore

  • Home
  • Add group
  • Groups page
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Users
  • Help
  • SEARCH

Footer

© 2021 The Archive Base. All Rights Reserved
With Love by The Archive Base

Insert/edit link

Enter the destination URL

Or link to existing content

    No search term specified. Showing recent items. Search or use up and down arrow keys to select an item.