Solved

Update query not working correctly?

Posted on 2007-04-09
1
207 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

DevOps Toolchain Recommendations

Read this Gartner Research Note and discover how your IT organization can automate and optimize DevOps processes using a toolchain architecture.

Question has a verified solution.

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

I'm trying, I really am. But I've seen so many wrong approaches involving date(time) boundaries I despair about my inability to explain it. I've seen quite a few recently that define a non-leap year as 364 days, or 366 days and the list goes on. …
Composite queries are used to retrieve the results from joining multiple queries after applying any filters. UNION, INTERSECT, MINUS, and UNION ALL are some of the operators used to get certain desired results.​
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 …
Along with being a a promotional video for my three-day Annielytics Dashboard Seminor, this Micro Tutorial is an intro to Google Analytics API data.

813 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

10 Experts available now in Live!

Get 1:1 Help Now