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 |
|
DeveloperIQ
Yak Posting Veteran
71 Posts |
Posted - 2009-01-21 : 17:52:51
|
| I may be having a brain freeze now, but in this example below, how do I update the NULL rows with the first non null value in the same column above for the same account numberFor example in set 1, subscriber for act 3 should all be 31.Thanks for your help in advanceact subcriber pat1 pat3 31 31 JOH23 NULL 32 SUSI23 NULL 33 MAR23 NULL 34 DAVI23 NULL 35 BILL23 NULL 36 RA22 21 21 JOHN2 NULL 22 SUSIE2 NULL 23 MARY2 NULL 24 DAVID2 NULL 25 BILLY2 NULL 26 RAY |
|
|
spirit1
Cybernetic Yak Master
11752 Posts |
Posted - 2009-01-21 : 18:04:54
|
| something like this:update t1set Subcriber = t2.MaxSubcriberfrom YourTable t1join(select act, max(subcriber) as MaxSubcriberfrom YourTablegroup by act) t2 on t1.act = t2.act___________________________________________________________________________Causing trouble since 1980Blog: http://weblogs.sqlteam.com/mladenpSpeed up SSMS development: www.ssmstoolspack.com <- version 1.1 out! |
 |
|
|
DeveloperIQ
Yak Posting Veteran
71 Posts |
Posted - 2009-01-21 : 18:07:08
|
| That works perfect!! Thanks for the solution. |
 |
|
|
|
|
|