My problem is I got 2 table 1 is coach and 1 is tool
- coach (cid, forename, surname, toolNo )
- tool (toolNo , registNo )
I want to change the coach "Will Smith" 's toolNo to 10 by using the registNo. However my code change everyone's toolNo but not only will smith's one.
insert into coach values ('c2','will','smith',5)
insert into tool values ('10', 'R123')
UPDATE coach
SET toolNo = t.toolNo
From coach c, tool t
WHERE t.registNo = 'R123'
AND c.forename ='Will'
AND c.surname = 'smith';