我有一个 table_a,我想用其他 2 个表中的数据进行更新。
table_a
+----+---------+------------+-------+
| id | user | date | valid |
+----+---------+------------+-------+
| 10 | Bob | | |
| 11 | Joe | | |
| 12 | Joe | | |
| 13 | Pete | | |
| 14 | Bob | | |
+----+---------+------------+-------+
日期来自 table_b 其中 table_b.rel_id = table_a.id
table_b
+----+----------+----------+
| id | rel_id | date |
+----+----------+----------+
| 30 | 8 | 10/10/11 |
| 31 | 9 | 10/10/11 |
| 32 | 10 | 10/10/11 |
| 33 | 11 | 10/10/11 |
| 34 | 12 | 10/10/11 |
| 35 | 13 | 10/10/11 |
| 36 | 14 | 10/10/11 |
+----+----------+----------+
有效来自 table_c 其中 table_c.rel_id = table_a.id
table_c
+----+----------+----------+
| id | rel_id | valid |
+----+----------+----------+
| 40 | 10 | yes |
| 41 | 11 | no |
| 42 | 12 | yes |
| 43 | 13 | no |
| 44 | 14 | yes |
| 45 | 15 | no |
| 46 | 16 | yes |
+----+----------+----------+
如何使用 SQL 查询来做到这一点?