我的查询PKEstimateProjectID 语句是
select d.PKEstimateProjectID
from estimate_project d,( select a.PKSemesterCourseID
from semester_course_ships a ,( select PKCourseID
from estimate_course where FKClassTypeID ='85d75476-d5e3-420b-a7dc-112f6f470534') b
where a.FKCourseID = b.PKCourseID) f where d.FKSemesterCourseID =f.PKSemesterCourseID order by FKAbilityProjectID --这里获取全部的PKEstimateProjectID
不知道怎么吧这里的PKEstimateProjectID 和上面传入的参数@studentid插入临时表~~,最后再用上面的 insert into student_estimate_ships(GUID,FKstudentID,PKEstimateProjectID) select NEWID(),@studentid,PKEstimateProjectID from #table//@studentid 是传入存储过程的学生ID~我不知道这个参数怎么提前插入临时表 插入到student_estimate_ships表~~最后的50分 还望哪位大神~~指导下 有代码~最好~小弟愚钝~~·不知道如何下手~~~~
INSERT INTO student_estimate_ships([GUID],FKstudentID,PKEstimateProjectID)
SELECT NEWID(),@studentid,d.PKEstimateProjectID
FROM semester_course_ships a JOIN estimate_course b
ON b. FKClassTypeID ='85d75476-d5e3-420b-a7dc-112f6f470534' AND a.FKCourseID = b.PKCourseID
JOIN estimate_project d
ON d.FKSemesterCourseID =a.PKSemesterCourseID