tags:

views:

40

answers:

0

Hi :D

In theory I mean who are the triggers but it is currently not as fix this, I'll try to explain it to see if someone can give me a wire.

I have a system that is weekly and contestants have a structure of my database in this way.

1 .- There is a table called Usuario_Semanas_Concurso in this table have a PK call id_semana_usuario this table has 12 entries per contestant representing the 12 weeks of the contest and each record has a start date.

2 .- There is a table called Menu_Diario containing a FK that is linked to the previous table and this table id_semana_usuario contains 7 records associated with the table above representing 7 days a week.

Relationship

So I wonder if I can create a Trigger to delegate this responsibility to Mysql, and able to do that when i update my date filed in primary table Mysql calculated in the FK table the 7 days of record that has associated

So such that when updating the record with id_semana_usuario = 565 as in the example that they illustrate

Bone associated records automatically 7 days that is assigned to that record is recalculated based on the date of the parent record.

I hope you have given me to understand and there is a way to resolve it with the db because I think that is something that concerns hahaha and not to charge both the server: (

Maybe somehing like that

CREATE TRIGGER updateFechas 
AFTER UPDATE 
ON Usuario_Semanas_Concurso
FOR EACH ROW BEGIN
    //Update 7 records of FK table and calculate dates something like that 
        ChildTable.record.date = (DATEADD(parent.date + 1 DAY))