MySQL Forums
Forum List  »  Triggers

Help with trigger
Posted by: Bryony Thompson
Date: April 23, 2012 04:35AM

Hello,

I am completely new to SQL and am trying to create a trigger to update a field when a field in another table is changed...

I have the following two tables with these fields in them...

PATIENTS
Patient_ID
Date_Of_Last_Appointment (Date)

APPOINTMENTS
Appointment_ID
Patient_ID
Date_Of_Appointment (Date)
Status

When a patient attends their appointment, the Status field is changed to "Arrived". When this happens I want the date of the appointment to be inserted into the "Date_Of_Last_Appointment" field for the appropriate patient in the Patients table.

I would really appreciate some help in writing this. I am afraid I haven't got anything at the moment as I have no clue where to even begin. Usually I try to write something first to get help on so sorry!

Options: ReplyQuote


Subject
Views
Written By
Posted
Help with trigger
2755
April 23, 2012 04:35AM
1307
April 23, 2012 08:00AM
1490
April 23, 2012 08:02AM


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.