MySQL Forums
Forum List  »  Triggers

Trigger : AFTER INSERT UPDATE on other table
Posted by: MICHAEL FAURE
Date: November 11, 2020 05:52PM

Hi,

I have 2 tables :


1) e_ with :

id_e (INT AI PRIMARY KEY)
c1 (VARCHAR)
c2 (INT)


2) e_h with :

id_e_h (INT AI PRIMARY KEY)
d1 (VARCHAR)
d2 (INT)

------------------------------------------------------------------------------------------

Using a trigger on e_h AFTER INSERT I'd like to UPDATE c2 WHERE c1 = d1

But I get the ERROR subquery returns more than 1 row

------------------------------------------------------------------------------------------

This is the trigger :

UPDATE e_ SET c2 =
(SELECT d2 FROM e_h WHERE c1 = d1)

------------------------------------------------------------------------------------------

May someone help me on how to fix that issue ?

Options: ReplyQuote


Subject
Views
Written By
Posted
Trigger : AFTER INSERT UPDATE on other table
1291
November 11, 2020 05:52PM


Sorry, you can't reply to this topic. It has been closed.

Content reproduced on this site is the property of the respective copyright holders. It is not reviewed in advance by Oracle and does not necessarily represent the opinion of Oracle or any other party.