我想消除重复的行并根据某些条件更新新值
考虑这个用例:
mysql> SELECT * FROM t1;
+------+------+
| ID | UF |
+------+------+
| 101 | 1 |
| 102 | 2 |
| 103 | 3 |
| 104 | 4 |
| 105 | 5 |
+------+------+
mysql> SELECT * FROM t2;
+------+------+
| ID | UF |
+------+------+
| 101 | 2 |
| 102 | 6 |
| 103 | 5 |
| 104 | 1 |
+------+------+
我需要使用以下值更新表格T1
+------+------+
| ID | UF |
+------+------+
| 101 | 2 |
| 102 | 6 |
| 104 | 1 |
+------+------+
,输出将是
+------+------+
| ID | UF |
+------+------+
| 101 | 2 |
| 102 | 6 |
| 103 | 3 |
| 104 | 1 |
| 105 | 5 |
+------+------+
有没有简单的方法来实现同样的目标?