Solved

Update query not working correctly?

Posted on 2007-04-09
1
205 Views
Last Modified: 2011-08-18
I want to run an update query that will update one column in a table with a value from another column in another table.  Here is the SQL query I am running:
UPDATE tblLetterPrint SET tblLetterPrint.LetterDate =("LTRDATA.LtrDate");
What I am getting is, instead of the VALUE of LtrDate from table LTRDATA, I am instead getting the text string LTRDATA. in the LetterDate field.  What I want to have instead is the column LetterDate, AFTER the query is run, will contain the date value that is stored in the column LtrDate in table LTRDATA.  I am sure there is a small change I am needing to get the above SQL query to work correctly, but I am not seeing what it is...
thank you
0
Comment
Question by:wendelina
1 Comment
 
LVL 142

Accepted Solution

by:
Guy Hengel [angelIII / a3] earned 125 total points
Comment Utility
what database?

UPDATE tblLetterPrint
  SET LetterDate = l.LtrDate
FROM tblLetterPrint  lp
JOIN LTRDATA l
  ON <join condition>

in case you have only 1 row in LTRDATA, you could use:

UPDATE tblLetterPrint SET tblLetterPrint.LetterDate =( SELECT LtrDate FROM LTRDATA);
0

Featured Post

How your wiki can always stay up-to-date

Quip doubles as a “living” wiki and a project management tool that evolves with your organization. As you finish projects in Quip, the work remains, easily accessible to all team members, new and old.
- Increase transparency
- Onboard new hires faster
- Access from mobile/offline

Join & Write a Comment

'Between' is such a common word we rarely think about it but in SQL it has a very specific definition we should be aware of. While most database vendors will have their own unique phrases to describe it (see references at end) the concept in common …
If you have heard of RFC822 date formats, they can be quite a challenge in SQL Server. RFC822 is an Internet standard format for email message headers, including all dates within those headers. The RFC822 protocols are available in detail at:   ht…
It is a freely distributed piece of software for such tasks as photo retouching, image composition and image authoring. It works on many operating systems, in many languages.
In this tutorial you'll learn about bandwidth monitoring with flows and packet sniffing with our network monitoring solution PRTG Network Monitor (https://www.paessler.com/prtg). If you're interested in additional methods for monitoring bandwidt…

743 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

Need Help in Real-Time?

Connect with top rated Experts

15 Experts available now in Live!

Get 1:1 Help Now