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 |
|
AskSQLTeam
Ask SQLTeam Question
0 Posts |
Posted - 2007-01-19 : 10:54:50
|
| SONALI writes "Hi I have a schema like this..col A col b colc col d1 1 1-1-2007 -1 2 2-2-2007 30 days1 3 2-10-2007 8 days2 1 1-3-2007 -2 2 3-3-2007 2 dayshow to compute the col d where i hv to show date diff from the last avaialble day?any help is appreciated:-)" |
|
|
nr
SQLTeam MVY
12543 Posts |
Posted - 2007-01-19 : 11:24:21
|
| select t1.col2 - t2.coldfrom tbl t1join tbl t2on t2.cold = (select max(t3.cold) where t3.col2 > t1.cold)==========================================Cursors are useful if you don't know sql.DTS can be used in a similar way.Beer is not cold and it isn't fizzy. |
 |
|
|
|
|
|