sqlfriends@sql.com
SSCommitted
Points: 1504
More actions
February 27, 2012 at 1:50 am
#253689
Hi;
I want merge the two rows is not null values.
Here my table
id name old new
1 test Null 5
1 test 6 Null
How can i merger the two row
Result format
Id name Old New
1 test 6 5
any one help for this problem..
sharath.chalamgari
SSCertifiable
Points: 5680
February 27, 2012 at 2:01 am
#1451925
Select id,name,sum(old),sum(new)
From Test1
Group By id,name
this will solve the purpose but will be the creteria that you need to merge these rows. will it be always null values or you will have values other than null
Naveshan
SSC Journeyman
Points: 90
February 27, 2012 at 4:25 am
#1451977
Select id,name,sum(isnull(old,0)),sum(isnull(new,0))
this could also work
Viewing 3 posts - 1 through 2 (of 2 total)
You must be logged in to reply to this topic. Login to reply