A 表中有列a,b,c
B表中有列 d,e,f
当A中的c等于B中的f时
让A.a=B.d
A.b=B.e
表A中的c和表B中的f有相同的数据,如果A.c=B.f,那么更新A.a=B.d,A.b=B.e,这样能够解释清楚吗?
B表中有列 d,e,f
当A中的c等于B中的f时
让A.a=B.d
A.b=B.e
表A中的c和表B中的f有相同的数据,如果A.c=B.f,那么更新A.a=B.d,A.b=B.e,这样能够解释清楚吗?
解决方案 »
- mysql_query()和 mysql_real_query()区别?
- Navicat for MySQL 如何生成关系图?
- 存储过程中怎样把结果集查询出来,并把值CONCAT成字符串输出
- mysql能群集吗?要实用的!有经验的来探讨一下
- mysqlimport导入一个txt文件出现的问题
- 如何将空的access数据库的结构导入到mysql中,急,在线等。
- 请问,在LINUX上关闭postgresql的指令是什么?
- 如何查看mysql数据库中一个表的用户密码~
- 如何设置mysql的库环境?
- sql 获取前1天,前2天,前3天...的时间段数据
- mysql数据库时间函数
- 关于超大型网站的数据库备份问题
set A.a=B.d,A.b=B.e
Error Code : 1064
You have an error in your SQL syntax; check the manual that corresponds to your MySQL server version for the right syntax to use near 'from a inner join b on A.c=B.c
set A.a=B.d,A.b=B.e' at line 1
(0 ms taken)
(0 ms taken)没有影响
+------+------+------+
| a | b | c |
+------+------+------+
| 1 | 2 | 3 |
| 2 | 3 | 4 |
| 3 | 4 | 5 |
+------+------+------+
3 rows in set (0.00 sec)mysql> select * from b;
+------+------+------+
| d | e | f |
+------+------+------+
| 1 | 3 | 5 |
| 2 | 1 | 3 |
| 6 | 7 | 4 |
+------+------+------+
3 rows in set (0.00 sec)mysql> update A,B set A.a=B.d,A.b=B.e where A.c=B.f;
Query OK, 3 rows affected (0.03 sec)
Rows matched: 3 Changed: 3 Warnings: 0mysql> select * from a;
+------+------+------+
| a | b | c |
+------+------+------+
| 2 | 1 | 3 |
| 6 | 7 | 4 |
| 1 | 3 | 5 |
+------+------+------+
3 rows in set (0.00 sec)mysql> select * from b;
+------+------+------+
| d | e | f |
+------+------+------+
| 1 | 3 | 5 |
| 2 | 1 | 3 |
| 6 | 7 | 4 |
+------+------+------+
3 rows in set (0.00 sec)