Please start any new threads on our new site at https://forums.sqlteam.com. We've got lots of great SQL Server experts to answer whatever question you can come up with.

 All Forums
 General SQL Server Forums
 New to SQL Server Programming
 updating a column based on another column

Author  Topic 

jim_jim
Constraint Violating Yak Guru

306 Posts

Posted - 2013-01-17 : 09:17:34
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
Master Smack Fu Yak Hacker

8781 Posts

Posted - 2013-01-17 : 09:30:37
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

306 Posts

Posted - 2013-01-17 : 09:58:27
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
   

- Advertisement -