sql 查询多表插入
Posted 初入博客园 从此开启代码之路
tags:
篇首语:本文由小常识网(cha138.com)小编为大家整理,主要介绍了sql 查询多表插入相关的知识,希望对你有一定的参考价值。
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 查询多表插入的主要内容,如果未能解决你的问题,请参考以下文章