我们有2张桌子
标题
+------+--------------- ----+---------------------+---------------------+
| id | title | subs_updated | created_at |
+------+--------------------+---------------------+---------------------+
| 104 | movie 1 | 2014-11-13 05:40:51 | 2014-11-11 12:08:28 |
| 129 | movie 2 | | 2014-11-11 12:08:29 |
+------+--------------------+---------------------+---------------------+
替补
+----+----------+----------+---------+---------------------+
| id | label | title_id | subs | created_at |
+----+----------+----------+---------+---------------------+
| 13 | English | 104 | English | 2014-11-12 05:05:39 |
| 15 | Italian | 104 | Italian | 2014-11-12 05:25:00 |
| 16 | Dutch | 104 | Dutch | 2014-11-13 05:40:51 |
| 18 | Arabic | 129 | Arabic | 2014-11-12 06:05:28 |
| 19 | Arabic | 129 | Arabic | 2014-11-12 06:07:23 |
+----+----------+----------+---------+---------------------+
请一些帮助
答案 0 :(得分:0)
试试这个
UPDATE
`title`
SET
subs_updated =
(SELECT
created_at
FROM
`subs`
WHERE subs.title_id = title.id ORDER BY created_at DESC LIMIT 1)