Skip to content

Instantly share code, notes, and snippets.

@joeke80215
Created November 19, 2018 07:41
Show Gist options
  • Save joeke80215/1050cfba285e92245ca4f49ee327ea01 to your computer and use it in GitHub Desktop.
Save joeke80215/1050cfba285e92245ca4f49ee327ea01 to your computer and use it in GitHub Desktop.
mysql add timestamp when update row
CREATE TRIGGER `testTrigger` BEFORE UPDATE ON `testTable`
FOR EACH ROW SET NEW.<timestamp col>=TIMESTAMPDIFF(SECOND,OLD.SENDTIME,NOW())
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment