+5  A: 
    Update Courses
    SET Courses.Instructor_ID = Course_Roster.User_ID
    from Courses Inner Join Course_Roster 
    On Course_Roster.CourseID = Courses.Course_ID

This is assuming that your DBMS allows for joins on your update queries. SQL Server definitely allows this. If you cannot do something like this you need to look towards using a subquery.

TheTXI
+2  A: 
UPDATE COURSES 
SET COURSES.INSTRUCTOR_ID = COURSE_ROSTER.USER_ID 
FROM COURSES
INNER JOIN COURSE_ROSTER
    ON COURSE_ROSTER.COURSE_ID = COURSES.COURSE_ID
Cade Roux
+2  A: 

Why do you need the column course.instructor_id if you fill it with COURSE_ROSTER.user_id? Isn't it redundant storage?

tuinstoel
its hosted off-site... i could care less... and its also a new system were implementing called ANGEL and i'm not exactly sure how the relations between all the tables work just yet
CheeseConQueso
I don't understand you answer? Why does it matter whether it is hosted off-site or not? Normalization remains normalization. And if you don't understand the relations between the tables you should not modify data.
tuinstoel
im just trying to have my way with the beast during test phase ok? im sorry if it offends you... and ill modify the data all day long if i want to !!! woohoo
CheeseConQueso
Please grow up cowboy.
tuinstoel
hahahah im not a cowboy, im a calfman - dont take offense, im just zipped on coffee all the time... and id rather run into a wall now and then have it running in the middle of semester and then crash the whole schoolbus into the wall
CheeseConQueso
+3  A: 

Not all database vendors (SQL Server, Oracle, etc.) Implement Update syntax in the same way... You can use a join in SQL Server, but Oracle will not like that. I believe just about all will accept a correclated subquery however

  Update Courses C  
   SET Instructor_ID = 
          (Select User_ID from Course_Roster
           Where CourseID = C.Course_ID)

NOTE: The column User_ID in Course_Roster would probably be better named as InstructorId (or Instructor_Id) to avoid confusion

Charles Bretana
well the course roster can contain students.. someone else made the schema up
CheeseConQueso
If the User_Id in Course Roster contains all the students' Ids, then why are you updating an Instructor_Id column with one of the Student's Ids? I assumed from your Update query (Since you're sticking into "Instructor_ID" column) that the User_ID in the Roster table WAS the the Instructor's UserId .
Charles Bretana
the course_roster table contains all the enrollments of students/instructors/admins/editors/guests allowed to view/participate in a single section identified by the course_idthe other table, courses, only shows their corresponding instructors and not all the student enrollments
CheeseConQueso
@Ken, Then if you use my suggested query, there will be multiple records in the Course_Roster table for that Course ID, no ? and each will have a different User_Id... You somehow need to specify which of these multiple ones you want the UserID from. perhaps UserType="Instructor", or equivilent?
Charles Bretana
@charles yeah, but that was something i knew i would have to do anyway and didn't want to overcomplicate the question that i really had - but thanks for looking out
CheeseConQueso
+1  A: 
UPDATE COURSES 
SET INSTRUCTOR_ID = CR.USER_ID 
FROM COURSES C
INNER JOIN COURSE_ROSTER CR   
   ON CR.COURSE_ID = C.COURSE_ID
vzczc