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 |
kmartin
Starting Member
5 Posts |
Posted - 2008-04-04 : 09:21:14
|
I have the table:Item |Into |Out |Diff------------------------------------------------------------------001 2008-01-05 00:00:00.000 2008-01-10 00:00:00.000 5001 2008-01-11 00:00:00.000 2008-01-20 00:00:00.000 9001 2008-01-21 00:00:00.000 2008-01-27 00:00:00.000 6001 2008-02-27 00:00:00.000 2008-03-03 00:00:00.000 5001 2008-03-05 00:00:00.000 2008-03-12 00:00:00.000 7099 2008-01-30 00:00:00.000 2008-01-30 16:00:00.000 0099 2008-02-06 00:00:00.000 2008-02-08 00:00:00.000 2099 2008-02-17 00:00:00.000 2008-02-19 00:00:00.000 2What I would like is difference between an 'Out' and an 'Into', such as... row one has an Out of 1/10/08 and row two has an Into of 1/11/08, a difference of 1 day, I can't seem to get another column to properly show this information. |
|
kmartin
Starting Member
5 Posts |
Posted - 2008-04-04 : 09:52:29
|
Hooah, I got it. Please feel free to close this thread |
 |
|
madhivanan
Premature Yak Congratulator
22864 Posts |
Posted - 2008-04-04 : 09:58:55
|
quote: Originally posted by kmartin Hooah, I got it. Please feel free to close this thread
Post your solution so that others can knowMadhivananFailing to plan is Planning to fail |
 |
|
kmartin
Starting Member
5 Posts |
Posted - 2008-04-04 : 11:30:08
|
quote: Originally posted by madhivanan
quote: Originally posted by kmartin Hooah, I got it. Please feel free to close this thread
Post your solution so that others can knowMadhivananFailing to plan is Planning to fail
Created a temp table with a new new column and updated the column with:datediff(day, retrn_dt, (select top 1 drop_off_dt from #temp2 where t2.retrn_dt <= drop_off_dt order by drop_off_dt)) |
 |
|
|
|
|