SQL Server Forums
Profile | Register | Active Topics | Members | Search | Forum FAQ
 
Register Now and get your question answered!
Username:
Password:
Save Password
Forgot your Password?

 All Forums
 General SQL Server Forums
 New to SQL Server Programming
 updating a column based on another column
 New Topic  Reply to Topic
 Printer Friendly
Author Previous Topic Topic Next Topic  

jim_jim
Constraint Violating Yak Guru

USA
298 Posts

Posted - 01/17/2013 :  09:17:34  Show Profile  Reply with Quote
Hi All
I'm trying to update a datetimefeild in a table from a datetimefeild in another table based on a cretia.Both the tables can be joined on a feild called requesno

Will the below query work ok

Update CR 
Set CR.contractdate = select CC.contractenddate from CC where FROM Customer_Request CR Inner join  CustomerContracts  CC
ON CR.requestno = CC.requestno
where CC.Indicator = 'Y' and requestno in


Thanks

webfred
Flowing Fount of Yak Knowledge

Germany
8760 Posts

Posted - 01/17/2013 :  09:30:37  Show Profile  Visit webfred's Homepage  Reply with Quote
update CR
set contractdate = CC.contractenddate
from Customer_Request CR
inner join CustomerContracts CC
ON CR.requestno = CC.requestno
where CC.Indicator = 'Y' and CC.requestno in (...?...)


Too old to Rock'n'Roll too young to die.
Go to Top of Page

jim_jim
Constraint Violating Yak Guru

USA
298 Posts

Posted - 01/17/2013 :  09:58:27  Show Profile  Reply with Quote
Thank You

quote:
Originally posted by webfred

update CR
set contractdate = CC.contractenddate
from Customer_Request CR
inner join CustomerContracts CC
ON CR.requestno = CC.requestno
where CC.Indicator = 'Y' and CC.requestno in (...?...)


Too old to Rock'n'Roll too young to die.

Go to Top of Page
  Previous Topic Topic Next Topic  
 New Topic  Reply to Topic
 Printer Friendly
Jump To:
SQL Server Forums © 2000-2009 SQLTeam Publishing, LLC Go To Top Of Page
This page was generated in 0.14 seconds. Powered By: Snitz Forums 2000