diff options
author | Vitaly Takmazov | 2018-03-13 15:32:54 +0300 |
---|---|---|
committer | Vitaly Takmazov | 2018-03-13 15:32:54 +0300 |
commit | 4889ccb2b6bf5708d2555698c58f672dc3479d07 (patch) | |
tree | a768f9d224873a3af7290c61ce39ca715eb7a724 /src/scripts | |
parent | f010d75872763547ecbe621ae3e8eb967950453f (diff) |
additional scripts
Diffstat (limited to 'src/scripts')
-rw-r--r-- | src/scripts/update_updated.sql | 2 |
1 files changed, 2 insertions, 0 deletions
diff --git a/src/scripts/update_updated.sql b/src/scripts/update_updated.sql new file mode 100644 index 00000000..39b29210 --- /dev/null +++ b/src/scripts/update_updated.sql @@ -0,0 +1,2 @@ +UPDATE messages, (SELECT messages.`message_id` midd, MAX(COALESCE(replies.ts, messages.ts)) lastt FROM messages LEFT JOIN replies ON messages.`message_id`=replies.`message_id` GROUP BY messages.`message_id`) res +SET messages.updated = res.lastt WHERE messages.`message_id` = res.midd ;
\ No newline at end of file |