MySQL trigger find a column after event

I have a trigger which updates a value in another before an insert/update/delete occurs.

What I want to do is find the value of a specific column in the row that was just added, and use that value in my insert or update.

How can this be done?

Answers


You should create additional table and log all changes. Inside triggers you can access old, new values by using NEW, OLD prefixes. Put them all (if you need all values which had been changed) into the log table.

Logging can be different. You can create table with the same structure with new columns {log_id, log_dtm}. Or if you need to log only certain fields you can create log table: {log_id, table, field, value, log_dtm} (or something like this).

Off course, to do it you should change your triggers to add new functionality.


Need Your Help

Future-proofing the .NET version detection

c# .net detection

Not to beat the dead horse, however, I am looking for a way to detect the installed .NET frameworks. It seems like the provided solutions (in the links) are all good up until the point a new vers...

Errors when using multi threaded runtime libraries with icc 14

c++ visual-c++ icc

When I use the /MT flag with ICC 14 I get these errors:

About UNIX Resources Network

Original, collect and organize Developers related documents, information and materials, contains jQuery, Html, CSS, MySQL, .NET, ASP.NET, SQL, objective-c, iPhone, Ruby on Rails, C, SQL Server, Ruby, Arrays, Regex, ASP.NET MVC, WPF, XML, Ajax, DataBase, and so on.