码迷,mamicode.com
首页 > 数据库 > 详细

sql 查询多表插入

时间:2018-11-06 13:26:50      阅读:260      评论:0      收藏:0      [点我收藏+]

标签:查询   edit   oss   cross   map   join   _id   mapping   art   

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 查询多表插入

标签:查询   edit   oss   cross   map   join   _id   mapping   art   

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

(0)
(0)
   
举报
评论 一句话评论(0
登录后才能评论!
© 2014 mamicode.com 版权所有  联系我们:gaon5@hotmail.com
迷上了代码!