Solved

Need some help on update

Posted on 2006-11-23
2
241 Views
Last Modified: 2008-03-04
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.
0
Comment
Question by:Ennio
[X]
Welcome to Experts Exchange

Add your voice to the tech community where 5M+ people just like you are talking about what matters.

  • Help others & share knowledge
  • Earn cash & points
  • Learn & ask questions
2 Comments
 
LVL 75

Expert Comment

by:Aneesh Retnakaran
ID: 18004254
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
 
LVL 14

Accepted Solution

by:
mherchl earned 500 total points
ID: 18004258
update tbl_user set fname = tbl_temp.fname
from tbl_user
join tbl_temp on tbl_temp.email = tbl_user.email
0

Featured Post

Get proactive database performance tuning online

At Percona’s web store you can order full Percona Database Performance Audit in minutes. Find out the health of your database, and how to improve it. Pay online with a credit card. Improve your database performance now!

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

JSON is being used more and more, besides XML, and you surely wanted to parse the data out into SQL instead of doing it in some Javascript. The below function in SQL Server can do the job for you, returning a quick table with the parsed data.
What if you have to shut down the entire Citrix infrastructure for hardware maintenance, software upgrades or "the unknown"? I developed this plan for "the unknown" and hope that it helps you as well. This article explains how to properly shut down …
This video shows, step by step, how to configure Oracle Heterogeneous Services via the Generic Gateway Agent in order to make a connection from an Oracle session and access a remote SQL Server database table.
Viewers will learn how the fundamental information of how to create a table.

623 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question