日期:2014-05-19  浏览次数:21041 次

select insert问题
我想把“SELECT  
Users.UserName,
OverTimeHead.OverTimeHeadId,
OverTimeList.OverTimeListId,
OverTimeHead.OrgName,
OverTimeList.StartDateTime,  
OverTimeList.EndDateTime,
OverTimeList.ActualWorkingHours  
FROM   OverTimeList
INNER   JOIN     Users   ON   OverTimeList.PK_User   =   Users.PK_User   INNER   JOIN   OverTimeHead   ON   OverTimeList.OverTimeHead   =OverTimeHead.OverTimeHeadId”
先出来的值插入到另一个表中(不是新建)

------解决方案--------------------
insert into yourtable(field1,field1, ...)
SELECT
Users.UserName,
OverTimeHead.OverTimeHeadId,
OverTimeList.OverTimeListId,
OverTimeHead.OrgName,
OverTimeList.StartDateTime,
OverTimeList.EndDateTime,
OverTimeList.ActualWorkingHours
FROM OverTimeList
INNER JOIN Users ON OverTimeList.PK_User = Users.PK_User INNER JOIN OverTimeHead ON OverTimeList.OverTimeHead =OverTimeHead.OverTimeHeadId”