January 25, 2017 at 11:21 am
January 25, 2017 at 12:17 pm
Thank a lot for the information guys! This really helped. I do have one more question
Say I have the following data
Customer RowNum SalesOrder Customer Quoted Hours
(100915) (2) (100915-2) (ARORA) (NULL)
(100915) (1) (100915-1) (ARORA) (10)
(100576) (1) (100576-1 ) (AMKOR) (12)
(100555) (1) ( 100555-1 ) (JACK) (8)
Is there anyway to copy the quoted hours from where rownum is 1 to the null value?
I was thinking something like this. But its not working correctly
UPDATE (TABLE NAME)
SET QuoteHours = QuoteHours
WHERE RowNum = 2
AND ORderNum IN ( SELECT OrderNum FROM #temptable WHERE RowNum = 1);
January 26, 2017 at 10:38 pm
ajkarora - Wednesday, January 25, 2017 12:17 PMThank a lot for the information guys! This really helped. I do have one more questionSay I have the following data
Customer RowNum SalesOrder Customer Quoted Hours
(100915) (2) (100915-2) (ARORA) (NULL)
(100915) (1) (100915-1) (ARORA) (10)
(100576) (1) (100576-1 ) (AMKOR) (12)
(100555) (1) ( 100555-1 ) (JACK) (8)Is there anyway to copy the quoted hours from where rownum is 1 to the null value?
I was thinking something like this. But its not working correctly
UPDATE (TABLE NAME)
SET QuoteHours = QuoteHours
WHERE RowNum = 2
AND ORderNum IN ( SELECT OrderNum FROM #temptable WHERE RowNum = 1);
What value do you expect in "Quoted Hours" for row with RowNum = 3 if your data looks like this?
How to post data/code on a forum to get the best help - Jeff Moden
http://www.sqlservercentral.com/articles/Best+Practices/61537/
Viewing 3 posts - 16 through 17 (of 17 total)
You must be logged in to reply to this topic. Login to reply