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.
Author |
Topic |
hdv212
Posting Yak Master
140 Posts |
Posted - 2010-12-27 : 12:38:55
|
Hisuppose we have a table with this type of data :id name family agexx1 null null nullnull xxx xxx xxxxx2 null null nullnull xxx xxx xxxnull xxx xxx xxx...as u can see, i have a record which have only id value and some records which have rest of columns value (except of id)i want to merge record which have id value with next rows which does not have id value while it reach to next row which have id value, something like this :id name family agexx1 xxx xxx xxxxx2 xxx xxx xxxxx2 xxx xxx xxx...can anybody help me which how to accomplish this ?thanks in advance |
|
X002548
Not Just a Number
15586 Posts |
|
Lamprey
Master Smack Fu Yak Hacker
4614 Posts |
Posted - 2010-12-27 : 13:04:26
|
Is there a column or combination of columns that you can use to determine the order of the rows? I.E. - What ORDER BY clause would you need in order to get the results of your table in the order you specified?SELECT Id, Name, Family, AgeFROM MyTableORDER BY ???To prodcue: id name family agexx1 null null nullnull xxx xxx xxxxx2 null null nullnull xxx xxx xxxnull xxx xxx xxx... |
 |
|
hdv212
Posting Yak Master
140 Posts |
Posted - 2010-12-27 : 13:10:32
|
i know this, but actually, this is not table, it is excel report of another application which i imported it to sql server, because i need a result as i described in my first post. |
 |
|
webfred
Master Smack Fu Yak Hacker
8781 Posts |
Posted - 2010-12-28 : 01:28:15
|
So if your excel sheet is ordered as you need then you should add a rownumber before importing into a database table. No, you're never too old to Yak'n'Roll if you're too young to die. |
 |
|
|
|
|