Prady
Prady

Reputation: 11310

SQL Help : Update a field

I have 2 tables course and course1 Both the tables have fields called name and id. Table course's id field is currently null. I need to update course table's id field with id of the course1, both tables are related with name field.

I am using access.

Thanks

Prady

Upvotes: 0

Views: 74

Answers (2)

JeffO
JeffO

Reputation: 8043

update [course 1]
inner join [course]
on course.name = [course 1].name
set [course 1].ID = [course].ID;

Upvotes: 3

Raj
Raj

Reputation: 1770

update table1 set id = b.id from table1 a inner join table2 b on a.name = b.name

This works on SQL Server. I haven't tried on Access but give it a try.

Upvotes: 1

Related Questions