Avatar of Pat Shortt
Pat Shortt
 asked on

Trigger To Update A Field When Field In Another Table Is Changed

I have a mysql database and I want a Trigger To Update A Field When Field In Another Table Is Changed.

Table 1 = cases_cstm and Table 2 = Contracts
I have an End date field in both tables.
The Field name under cases_cstm is enddate_c
The field name under Contracts is end_date

I would like when a Case is created to copy the End date from Contracts to Cases
MySQL ServerDatabasesDB Reporting Tools

Avatar of undefined
Last Comment
NerdsOfTech

8/22/2022 - Mon
ste5an

Review your model. This is redundancy at its best.
Pat Shortt

ASKER
I don't understand your comment?
ste5an

Normalization. Why copying a value at all? This value should be stored only once.
This is the best money I have ever spent. I cannot not tell you how many times these folks have saved my bacon. I learn so much from the contributors.
rwheeler23
Pat Shortt

ASKER
Cause I need to display the same date in 2 different views. one in Cases and one in Contracts.
SOLUTION
Pavel Celba

THIS SOLUTION ONLY AVAILABLE TO MEMBERS.
View this solution by signing up for a free trial.
Members can start a 7-Day free trial and enjoy unlimited access to the platform.
See Pricing Options
Start Free Trial
GET A PERSONALIZED SOLUTION
Ask your own question & get feedback from real experts
Find out why thousands trust the EE community with their toughest problems.
ASKER CERTIFIED SOLUTION
NerdsOfTech

THIS SOLUTION ONLY AVAILABLE TO MEMBERS.
View this solution by signing up for a free trial.
Members can start a 7-Day free trial and enjoy unlimited access to the platform.
See Pricing Options
Start Free Trial
⚡ FREE TRIAL OFFER
Try out a week of full access for free.
Find out why thousands trust the EE community with their toughest problems.