October 18, 2007 at 3:29 pm
Hello all,
I have a large data table with many duplicated ID records. A portion of my data table as following:
ID | saleDate | SaleAmount
==============================
40 | 06/23/2003 | 242
41 | 11/30/2001 | 1000
40 | 12/28/2006 | 343
41 | 10/25/1996 | 154
41 | 04/27/2007 | 1234
42 | 05/07/2006 | 777
I would like to update all duplicated records using SUM(SaleAmount) to replace for SaleAmount.
The data result will be
ID | saleDate | SaleAmount
==============================
40 | 06/23/2003 | 585 (242 + 342)
41 | 11/30/2001 | 2388 (1000+1234+154)
40 | 12/28/2006 | 585
41 | 10/25/1996 | 2388
41 | 04/27/2007 | 2388
42 | 05/07/2006 | 777
Please help me with TSQL for update. Your time is much appreciated. Thanks in advance.
October 18, 2007 at 3:53 pm
Try not to double-post.
http://www.sqlservercentral.com/Forums/Topic412429-338-1.aspx
----------------------------------------------------------------------------------
Your lack of planning does not constitute an emergency on my part...unless you're my manager...or a director and above...or a really loud-spoken end-user..All right - what was my emergency again?
Viewing 2 posts - 1 through 1 (of 1 total)
You must be logged in to reply to this topic. Login to reply