星期三, 3月 10, 2010

Update From Query

UPDATE    Art.dbo.Course
SET              Art.dbo.Course.CourseStart = Shanghai.dbo.Course.BeginDate
from Art.dbo.Course,Shanghai.dbo.Course
WHERE     (Art.dbo.Course.CourseID =  Shanghai.dbo.Course.CourseID)

UPDATE   Members
SET             MemberProfessional = Professional
from Members,TeacherProfessional
WHERE     (MemberNo = No)

同以下語法
UPDATE    Members
SET              MemberProfessional = TeacherProfessional.Professional
FROM         Members INNER JOIN
                      TeacherProfessional ON Members.MemberNo = TeacherProfessional.No

Reference:
http://blog.yam.com/masonblog/article/11536008
Update from a Select
update 问题,更新 表一的A字段 = 表二的B字段

沒有留言:

張貼留言

留個話吧:)

其他你感興趣的文章

Related Posts with Thumbnails