当前位置:网站首页>【MySQL】 insert into ... select ...
【MySQL】 insert into ... select ...
2022-07-20 16:56:00 【sayyy】
两个表的表结构相同时
insert into sys_menu
select *
from sys_menu_back
where menu_id=2092;
同一个表复制数据时
insert into sys_menu
select *
from sys_menu
where menu_id=2092 or parent_id=2092;
- 报错:
ERROR #1062
1. 将表的所有列名拼接成字符串
SELECT GROUP_CONCAT(CONCAT('`', `column_name`, '`') ORDER BY `ordinal_position`)
FROM `information_schema`.`columns`
WHERE `table_schema`=DATABASE() AND `table_name`='sys_menu';
2编写 insert into … select …
insert into `sys_menu` (`menu_name`,`parent_id`,`order_num`,`url`,`target`,`menu_type`,`visible`,`is_refresh`,`perms`,`icon`,`create_by`,`create_time`,`update_by`,`update_time`,`remark`)
select `menu_name`,`parent_id`,`order_num`,`url`,`target`,`menu_type`,`visible`,`is_refresh`,`perms`,`icon`,`create_by`,`create_time`,`update_by`,`update_time`,`remark`
from `sys_menu`
where `menu_id`=2092;
边栏推荐
- "Fundamentals of program design" Chapter 10 function and program structure 7-1 circular volume calculator (20 points)
- MongoDB-分片
- 华为P30 Pro拆解:结构紧凑做工精细,核心器件供应商曝光!
- 什么是 Skia ?
- 《程序设计基础》 第十章 函数与程序结构 6-7 判断满足条件的三位数 (15 分)
- lotus-bench 1.17.0-rc3 Benchmarks
- 2021-9-21
- 分布式高并发高可用FastDFS文件服务器集群部署
- "Fundamentals of program design" Chapter 10 function and program structure 7-2 Hanoi Tower problem (20 points)
- Wechat applet 22 recommend and songdetail are initially set up
猜你喜欢
联想曝新型UEFI漏洞,影响70款数百万台笔记本电脑
2021-9-18
WPS前骨干历时10年打造新型软件,Excel用户:我为此改用WPS
Wechat applet 20 improve video page ①
使用 FVTool 进行滤波器分析
"Fundamentals of program design" Chapter 10 function and program structure 6-11 recursive calculation of P function (15 points)
线性回归模型笔记(2)
HTB-Bashed
山东大学、北邮、哈工大| Multimodal Dialog Systems with Dual Knowledge-enhanced Generative Pretrained Language Model(具有双重知识增强生成预训练语言模型的多模态对话系统)
Wechat applet 19 video list
随机推荐
HTB-Bashed
A woman who didn't accept Shan Xiu when looking for a job was humiliated by HR: we're not looking for a junior
消防安全不能忘!广州这11处场所存在火灾隐患
Reasons and solutions for more data entries than the original data table after left join/inner join
What is skia?
WPS前骨干历时10年打造新型软件,Excel用户:我为此改用WPS
一女子找工作不接受单休遭HR羞辱:我们不是在找小三
"Fundamentals of program design" Chapter 10 function and program structure 6-11 recursive calculation of P function (15 points)
【若依(ruoyi)】popover
智能科学创新讲堂 | 自动化所何晖光: 基于视觉信息编解码的深度学习类脑机制研究
sqlilabs less-25~25a
如何在 FreeBSD 上设置 PF 防火墙来保护 Web 服务器
2021-9-18
龙蜥社区发布首个 Anolis OS 安全指南 为用户业务系统保驾护航
416. Segmentation and subsets
AIX挂载NFS写入效率低的解决方案
Selection bias induced spurious correlations in large language models
MySQL realizes master-slave synchronization and master-master synchronization based on binlog
EL&JSTL:JSTL总结
unity spritemask实现