27,579
社区成员
发帖
与我相关
我的任务
分享
INSERT INTO [MsgList]([Type],[User],[Party],[Content],[LinkUrl],[Title],[M_Id]
,[Form],[Number],[Name],[Time]);
WITH temps
AS(
SELECT *** FROM tb1)
SELECT *** FROM tb2 INNER JOIN temps ON tb2 .Name=temps.GroupName
;WITH temps AS(
SELECT * * * FROM tb1
)
INSERT INTO [MsgList]
(
[Type],
[User],
[Party],
[Content],
[LinkUrl],
[Title],
[M_Id],
[Form],
[Number],
[Name],
[Time]
)
SELECT * * *
FROM tb2
INNER JOIN temps
ON tb2 .Name = temps.GroupName
特别要注意 ; , ; 标识前面的一个语句结束, 不能随便加。
你想想 insert 还没有给值 , 就结束了, 能不报错吗?
另外, with 这种情况也只能放 insert 前面。
WITH temps
AS(
SELECT *** FROM tb1)
INSERT INTO [MsgList]([Type],[User],[Party],[Content],[LinkUrl],[Title],[M_Id]
,[Form],[Number],[Name],[Time])
SELECT *** FROM tb2 INNER JOIN temps ON tb2 .Name=temps.GroupName