如果新日期等于旧日期,MySQL触发更新行

时间:2020-08-07 13:03:47

标签: mysql triggers

我有这张桌子:

id
sender_id - int
user_id - int
type - string
content - string
content_type - string
date - timestamp

例如,我已经有以下行:

sender_id - 1
user_id - 0
type - 'all'
content - 239
content_type - 'added'
date - 13.19.2020 20:30:14

是否可以创建触发器,当添加新行时,它可以检查现有行,如果NEW.time距此OLD.row少于1小时,则此行内容将类似于:

sender_id - 1
user_id - 0
type - 'all'
content - 239, 349
content_type - 'added'
date - 13.19.2020 20:45:14

如果超过1小时->添加新行

0 个答案:

没有答案
相关问题