侧边栏壁纸
  • 累计撰写 781 篇文章
  • 累计创建 1 个标签
  • 累计收到 1 条评论
标签搜索

insert

Dettan
2021-04-10 / 0 评论 / 0 点赞 / 88 阅读 / 1,447 字
温馨提示:
本文最后更新于 2022-04-28,若内容或图片失效,请留言反馈。部分素材来自网络,若不小心影响到您的利益,请联系我们删除。
/ DATA / insert
INSERT INTO `auction`.`sys_menu` (`parent_id`, `name`, `title`, `component`, `path`, `perms`, `type`, `icon`, `hidden`, `order_num`, `always_show`, `redirect`, `no_cache`, `affix`, `breadcrumb`, `active_menu`, `time`) 
VALUES 
(355, NULL, '查看自己', NULL, NULL, 'supplier:listMy', 1, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL),
(355, NULL, '查看全部', NULL, NULL, 'supplier:listAll', 1, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL),
(355, NULL, '添加', NULL, NULL, 'supplier:save', 1, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL),
(355, NULL, '修改', NULL, NULL, 'supplier:update', 1, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL),
(355, NULL, '删除', NULL, NULL, 'supplier:delete', 1, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL);
失败跳过
insert ignore into
跳过重复数据, 应该是插入失败都会跳过

insert select
INSERT INTO words ( word, meaning ) SELECT
word,
meaning 
FROM
	all_words a left OUTER join 
 (
	SELECT
		a.id 
	FROM
		all_words a
		JOIN good_words g ON a.word = g.Word 
		OR a.word = g.FS 
		OR a.word = g.GQFC 
		OR a.word = g.GQS 
		OR a.word = g.XZFC 
	) ids on a.id = ids.id
	where ids.id is null;




db2
不能 ignore 没有意义
INSERT  into T_MAP_ICON (FD_DEVICE_ID , FD_ASSOCIATE_ID,FD_TYPE,FD_LEVEL)
 SELECT FD_ROWID AS FD_DEVICE_ID,'149'AS FD_ASSOCIATE_ID,'device'AS fd_TYPE ,'device' AS FD_LEVEL 
	FROM T_BASEINFO 
	WHERE FD_FACTORYCODE = '149';
用merge
MERGE INTO T_MAP_ICON i
	USING (SELECT * FROM T_BASEINFO WHERE FD_BRANCHCODE ='163')  b
		ON i.FD_DEVICE_ID = b.FD_ROWID
WHEN MATCHED THEN
	UPDATE SET i.FD_ASSOCIATE_ID = '163'
WHEN NOT MATCHED THEN
	INSERT  (FD_DEVICE_ID , FD_ASSOCIATE_ID,FD_TYPE,FD_LEVEL)
		VALUES (b.FD_ROWID ,'163','device','device');

0

评论区