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
 Merging two rows in SQL

Author  Topic 

jjz
Starting Member

31 Posts

Posted - 2010-07-15 : 09:16:36
Hi

Is it possible to merge to rows in SQL, below is the example of what i am trying to achieve:

SerialNumber Cleaned_Serial PONumber Invoice_Number DTS_Asset__
Example1
Row1: #SCNK2N41583 #SCNK2N41583 ABA-H9924
Row2: #SCNK2N41583 #SCNK2N41583 AS1043242
Example1
Row1: %7406XDC1512 %7406XDC1512 AS104100009910
Row2: %7406XDC1522

Desired Results:
Row1: #SCNK2N41583 #SCNK2N41583 ABA-H9924 AS1043242

Row2:7406XDC1512 %7406XDC1512 AS104100009910 AS1031549

I have a file with duplicate serial numbers but the info is stored in more than one row and i need to only have one record for each serial number, i am therefore trying to update the data from one row to the other to contain only one record.

I cannot just run an ordinary update because, i have a table with more than just one record and it is impossible for me to run it one by one.

madhivanan
Premature Yak Congratulator

22864 Posts

Posted - 2010-07-16 : 11:31:36
http://www.sqlteam.com/forums/topic.asp?TOPIC_ID=81254

Madhivanan

Failing to plan is Planning to fail
Go to Top of Page
   

- Advertisement -