Solved

Compare & Update Dates In Two Tables

Posted on 2011-02-18
2
396 Views
Last Modified: 2012-05-11
Hello Experts,

I have two tables, Jobs & GoodsReceipts. In Jobs there is an ActionDate (datetime) column which I need to compare with GoodsReceipts column Date (datetime) and if they differ, update GoodsReceipts with the new date.

I am sure the answer is very simple but I am having one of them days :(

I'm using MS SQL SERVER 2008.

Thanks,


David
0
Comment
Question by:NewFourWalls
2 Comments
 
LVL 142

Accepted Solution

by:
Guy Hengel [angelIII / a3] earned 500 total points
Comment Utility
update with join is explained here:
http://www.experts-exchange.com/A_1517.html

UPDATE r
  SET GoodsREceips = j.ActionDate
  FROM GoodsReceipts r
  JOIN Jobs j
    ON r.key_column = j.key_column
   WHERE r.GoodsREceips <> j.ActionDate 

Open in new window

0
 

Author Closing Comment

by:NewFourWalls
Comment Utility
Thank you.

I used a different example from the page you sent and it works great.
0

Featured Post

Enabling OSINT in Activity Based Intelligence

Activity based intelligence (ABI) requires access to all available sources of data. Recorded Future allows analysts to observe structured data on the open, deep, and dark web.

Join & Write a Comment

There have been several questions about Large Transaction Log Files in SQL Server 2008, and how to get rid of them when disk space has become critical. This article will explain how to disable full recovery and implement simple recovery that carries…
In this article I will describe the Copy Database Wizard method as one possible migration process and I will add the extra tasks needed for an upgrade when and where is applied so it will cover all.
This video gives you a great overview about bandwidth monitoring with SNMP and WMI with our network monitoring solution PRTG Network Monitor (https://www.paessler.com/prtg). If you're looking for how to monitor bandwidth using netflow or packet s…
This video explains how to create simple products associated to Magento configurable product and offers fast way of their generation with Store Manager for Magento tool.

771 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

9 Experts available now in Live!

Get 1:1 Help Now