Need some help on update

I have a temp table with a field fname and email.
and I need to update my tbl_user with the fname from the temp table where the email matches the email from the temp table.

here is my SQL

update tbl_user set fname =
(select fname from tbl_temp where tbl_temp.email = tbl_user.email)
where tbl_user.email = tbl_temp.email

and I'm getting an error

Msg 4104, Level 16, State 1, Line 1
The multi-part identifier "tbl_temp.email" could not be bound.
LVL 1
EnnioAsked:
Who is Participating?

[Webinar] Streamline your web hosting managementRegister Today

x
 
mherchlConnect With a Mentor Commented:
update tbl_user set fname = tbl_temp.fname
from tbl_user
join tbl_temp on tbl_temp.email = tbl_user.email
0
 
Aneesh RetnakaranDatabase AdministratorCommented:
update tu set fname =  tt.fname
from tbl_user tu
inner join tbl_temp on tbl_temp.email = tbl_user.email
where tbl_user.email = tbl_temp.email
0
All Courses

From novice to tech pro — start learning today.