Solved

Update query not working correctly?

Posted on 2007-04-09
1
206 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
ID: 18876285
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

Is Your Active Directory as Secure as You Think?

More than 75% of all records are compromised because of the loss or theft of a privileged credential. Experts have been exploring Active Directory infrastructure to identify key threats and establish best practices for keeping data safe. Attend this month’s webinar to learn more.

Question has a verified solution.

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

In database programming, custom sort order seems to be necessary quite often, at least in my experience and time here at EE. Within the realm of custom sorting is the sorting of numbers and text independently (i.e., treating the numbers as number…
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…
This Micro Tutorial hows how you can integrate  Mac OSX to a Windows Active Directory Domain. Apple has made it easy to allow users to bind their macs to a windows domain with relative ease. The following video show how to bind OSX Mavericks to …
Sending a Secure fax is easy with eFax Corporate (http://www.enterprise.efax.com). First, just open a new email message. In the To field, type your recipient's fax number @efaxsend.com. You can even send a secure international fax — just include t…

863 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

26 Experts available now in Live!

Get 1:1 Help Now