首页
学习
活动
专区
工具
TVP
发布
社区首页 >问答首页 >我需要遍历表格并在另一个表格中插入新记录

我需要遍历表格并在另一个表格中插入新记录
EN

Stack Overflow用户
提问于 2018-05-31 17:01:25
回答 1查看 69关注 0票数 0

我需要循环通过表组织,并在用户表中插入新记录

Select Code,Organisationid from organisation 

INSERT INTO User(userlogin,Organisationid,emailaddress,username,userpassword)
VALUES('AGT'+ Code, organisationid,'test@gmail.com','User'+ Code,'123')

我需要动态地将Organisationid和Code传递给user表,以循环并在User中插入新记录。

EN

回答 1

Stack Overflow用户

发布于 2018-05-31 17:03:10

只需使用INSERT INTO ... SELECT即可

INSERT INTO User (userlogin, Organisationid, emailaddress, username, userpassword)
SELECT 'AGT' + Code, organisationid, 'test@gmail.com', 'User' + Code, '123'
FROM organisation;
票数 3
EN
页面原文内容由Stack Overflow提供。腾讯云小微IT领域专用引擎提供翻译支持
原文链接:

https://stackoverflow.com/questions/50620455

复制
相关文章

相似问题

领券
问题归档专栏文章快讯文章归档关键词归档开发者手册归档开发者手册 Section 归档