Skip to content
Advertisement

Create a table in a trigger and compare it

i have 4 tables and i want to create a trigger that it declares a table and store it all in that table so it can be compared latter.

In here are the tables that im using. But now i have a trigger that after insert on orders it inserts on transactions. My objective now its to create a trigger that generates a table that takes order and order item and store id_product id_order and quantity so it can be used to after update on transaction the stock is changed on the respective items on tabel inventory.

This is the trigger that i have so far but i cant use it because i dont rly know how to declare a table in mysql:

Advertisement

Answer

You can’t you have to use a temporaRY TABLE

But usually you make a temporaray atble with a select

User contributions licensed under: CC BY-SA
8 People found this is helpful
Advertisement