MySQL Forums
Forum List  »  Triggers

Copy trigger
Posted by: Joe Borg
Date: February 24, 2011 09:19AM

Here's an example of what I'm trying to achieve.

I have a list of people in a table called people and a table called location with there current and all recorded check-in locations, for example

PEOPLE
---------
FirstName: Jim
LastName: Smith
DoB: 27/03/1979
etc etc

LOCATION
----------
FirstName: Jim
LastName: Smith
Location: London
Timestamp: 1843218

FirstName: Jim
LastName: Smith
Location: London
Timestamp: 21561864


What I was doing was left joining the location table onto the people table to show their latest location in respect to the timestamp, but this took upto 30seconds to load so isn't an option. What I want to do is write a trigger so that everytime a new location is added, the location field is copied into a field in people, also called location.

Is this possible? I've not had much experience with triggers.

Options: ReplyQuote


Subject
Views
Written By
Posted
Copy trigger
3306
February 24, 2011 09:19AM
1326
February 24, 2011 03:07PM


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.