MySQL Lists are EOL. Please join:

List:General Discussion« Previous MessageNext Message »
From:Machiel Richards Date:January 1 1970 12:00am
Subject:Re: Assistance with trigger
View as plain text  
Please ignore my request as I have managed to figure this out.

Thank you.

had to rewrite the insert to use Old.Column1... etc... and that works quite well.

From: Machiel Richards <machiel@stripped>
Sent: Friday, 26 April 2019 10:48 AM
To: mysql@stripped
Subject: Assistance with trigger

Hi All

   I am hoping this email finds all well.

    I would like to request some assistance with a MySQL trigger please.

    We need to implement a trigger that will in short terms make a backup of a row before
it gets deleted.

    so we have tableA and TableB (backup table).

    I added a before delete trigger to insert into TABLEB select from TABLEA... However
upon delete it inserts the whole table instead of only the single row being deleted.

Here is my insert and select statement :

INSERT INTO tableB (Column1,backup_date,updated_by_user,Column4) SELECT
Column1,NOW(),`username`,Column2 from tableA;

How can I rewrite this section to only select and insert the rows that are actually being

Your help would be greatly appreciated as I have not been able to find the answer on
google as yet.


Assistance with triggerMachiel Richards26 Apr
Re: Assistance with triggerMachiel Richards26 Apr