有两个表
都有item_type字段 其他的字段有些相同 有些不同由于要对应插入的字段实在是太多 不想一个一个对照着写下去 请问各位大侠有什么好的解决方法
都有item_type字段 其他的字段有些相同 有些不同由于要对应插入的字段实在是太多 不想一个一个对照着写下去 请问各位大侠有什么好的解决方法
解决方案 »
- MySQL用户权限可以在数据库中的表进行限制吗?限制某个用户只读写某个表?
- insert...select问题
- 什么命令返回一个表的属性
- 宾馆软件是mssql的,想转到mysql.不知道这句存储过程该如何变化
- 数据备份/恢复的问题(就40分了,各位朋友帮一下)
- 如何获得某ID前后5条记录的ID?
- 是关于ASP+MYSQL运行不稳定问题.
- 关于对mysql数据库的大数据量访问!!
- 往数据库中放图片,是直接放图片好,还是放链接??
- mysql中mysql_stmt_fetch返回值MYSQL_DATA_TRUNCATED的问题
- 请教一种在MySQL中的对数据的统计方法
- 如何在执行insert语句后触发器触发其他程序
set table1.coln=talbe2.coln
inser into tt(f1,f2,f3) select f2,f3,f1 from tt1
则没什么好办法。一般是直接先把所有列DESC出来,然后贴到EXCEL中,再字处理一下。
+----+-------+------------+
| id | value | articles |
+----+-------+------------+
| 1 | aaa | 1-2,4-9,37 |
| 2 | bbb | 23,80 |
| 3 | ccc | 1-24 |
+----+-------+------------+
3 rows in set (0.00 sec)mysql> select * from test;
+----+-------+---------+-----+
| id | class | name | age |
+----+-------+---------+-----+
| 1 | A | aaa | 20 |
| 2 | A | bbb | 25 |
| 3 | B | ddd | 30 |
| 4 | C | sss | 40 |
| 5 | B | sssffff | 50 |
| 6 | A | rrr | 33 |
| 7 | A | eee | 15 |
| 8 | B | www | 55 |
| 9 | C | hhh | 22 |
+----+-------+---------+-----+
9 rows in set (0.00 sec)mysql> insert into test select null,value,articles,10 from text;
Query OK, 3 rows affected (0.02 sec)
Records: 3 Duplicates: 0 Warnings: 0mysql> select * from test;
+----+-------+------------+-----+
| id | class | name | age |
+----+-------+------------+-----+
| 1 | A | aaa | 20 |
| 2 | A | bbb | 25 |
| 3 | B | ddd | 30 |
| 4 | C | sss | 40 |
| 5 | B | sssffff | 50 |
| 6 | A | rrr | 33 |
| 7 | A | eee | 15 |
| 8 | B | www | 55 |
| 9 | C | hhh | 22 |
| 10 | aaa | 1-2,4-9,37 | 10 |
| 11 | bbb | 23,80 | 10 |
| 12 | ccc | 1-24 | 10 |
+----+-------+------------+-----+
12 rows in set (0.00 sec)
mysql> update test set age=15 where id=10;
Query OK, 1 row affected (0.03 sec)
Rows matched: 1 Changed: 1 Warnings: 0其中10这个constant就是两表之间不同值的列 要你自己进行update的