Assistance with trigger

Machiel Richards <[email protected]> Fri, 26 Apr 2019 08:48:36 +0000
Newsgroups gmane.comp.db.mysql.general
Message-ID <AM0P192MB0275C8FFD5C31826E4E93A92CF3E0@AM0P192MB0275.EURP192.PROD.OUTLOOK.COM>
--_000_AM0P192MB0275C8FFD5C31826E4E93A92CF3E0AM0P192MB0275EURP_
Content-Type: text/plain; charset="iso-8859-1"
Content-Transfer-Encoding: quoted-printable

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 o=
f 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 TABLE=
A... However upon delete it inserts the whole table instead of only the sin=
gle row being deleted.

Here is my insert and select statement :


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



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

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

Regards





--_000_AM0P192MB0275C8FFD5C31826E4E93A92CF3E0AM0P192MB0275EURP_--