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 9151567
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 17, 20262026-06-17T11:50:05+00:00 2026-06-17T11:50:05+00:00

this is the query that i am using create trigger trig1 after insert on

  • 0

this is the query that i am using

create trigger trig1 after insert on participant for each row
begin
insert into team(sap) select sap from participant order by ID desc limit 1,1
end;

it is supposed to copy the sap field from the participant table into the sap field of the team table after a new row is inserted into the participant table
the engine shows me an unexpected end of input error at the end of “end”

i’ve tried numerous methods to rework the query but i keep getting the same error
what am i doing wrong?

thanks

  • 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-06-17T11:50:07+00:00Added an answer on June 17, 2026 at 11:50 am

    You are using trigger than no need to run a query on same table to get latest sap value, you can directly get that value using new.sap.

    Problem in your query, In your query you haven’t put semicolon(;) after INSERT..SELECT query and END keyword.

    This will work for you:

    DELIMITER $$
    
    DROP TRIGGER /*!50032 IF EXISTS */ `trig1`$$
    
    CREATE
        TRIGGER `trig1` AFTER INSERT ON `participant` 
        FOR EACH ROW BEGIN
            INSERT INTO team(sap) 
            VALUES(new.sap);
        END;
    $$
    
    DELIMITER ;
    
    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

I have this query that inserts rows, using a subquery like so: INSERT INTO
Below is the query that I am using to backup (create a .bak )
I need to execute a SQL query two hours after I insert a row
Im running the following query from my PhpMyadmin sql tab CREATE TRIGGER testTrigger AFTER
This query that I have is returning therapists whose 'therapistTable.activated' is equal to false
I've got this query that works ok, select * from Materia where Cursar_Cursada=0 and
I have have this query that i want to execute. SELECT warehouse.expiry_date, pharmacy.expiry_date, drugs.active_substance,
I have this query that returns the results by ordering it by focus.name ASC.
I have this query that, due to the number of records, is taking several
So I have this query that works perfectly: SELECT users.*, GROUP_CONCAT(categories.category_name) AS categories FROM

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.