首页 > 数据库技术 > 详细

sql 查询多表插入

时间:2018-11-06 13:17:51      阅读:105      评论:0      收藏:0      [点我收藏+]

insert into ArticleCategory_Customer_Edit_Mapping (Customer_Id,ArticleCategory_Id)
//1 少用
SELECT c.Id as CustomerId,a.Id as CategoryId FROM Customer as c CROSS JOIN ArticleCategory as a where c.Id>=781 and c.Id<=937 and (a.Id in (4,8,36) or a.ParentId in(4,8,36))

//2 多数据用
select c.Id as CustomerId,a.Id as CategoryId from Customer c inner join ArticleCategory a on c.Id>=781 and c.Id<=937 and (a.Id in (4,8,36) or a.ParentId in(4,8,36))

sql 查询多表插入

原文:https://www.cnblogs.com/zhubangchao/p/9914370.html

(0)
(0)
   
举报
评论 一句话评论(0
关于我们 - 联系我们 - 留言反馈 - 联系我们:wmxa8@hotmail.com
© 2014 bubuko.com 版权所有
打开技术之扣,分享程序人生!