• 将一个表的字段数据插入到另一个表的字段数据中
	/** sys_guid 随机id */
	insert into t_A (shouruid,userid,username,userdeptid,userdeptname)
		select sys_guid(),userid,username,deptcode,deptname from t_B 
  • 多个表的多个字段,插入同一个表的多个字段
		insert into t_A (shouruid,userid,username,userdeptid,userdeptname)
		select sys_guid(),B.userid,B.username,C.deptcode,C.deptname
		from t_B B, t_Bmx C 
		where B.Bcode= C.Bcode  and B.scbj = '0' and 
		B.mxcode  not in (select procode from t_A where ywlx = 'ABC' and scbj = '0')
Logo

为开发者提供学习成长、分享交流、生态实践、资源工具等服务,帮助开发者快速成长。

更多推荐