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 |
|
harshal_in
Aged Yak Warrior
633 Posts |
Posted - 2007-05-21 : 15:36:05
|
| Hi all,I'll try to explain my problem:create table #temp (tempid int, Cycle int, Number int)insert into #tempselect 1,0,12 union allselect 1,1,NULL union allselect 1,2,24 union allselect 2,0,12 union allselect 1,3,40 union allselect 2,1,23 union allselect 2,2,NULLI am trying to get the result set asNumber_diff tempid16 112 111 2for tempid =1 , number of cycle3 - number of cycle 2for tempid =1 , number of cycle2 - number of cycle 0 as number of cycle 1 is nullAny pointers are much appreciated.Thanks for the efforts.~Harshal |
|
|
jsmith8858
Dr. Cross Join
7423 Posts |
Posted - 2007-05-21 : 15:42:06
|
| I have no idea what you are looking for. It might be helpful if you carefully explain EXACTLY what you need.- Jeffhttp://weblogs.sqlteam.com/JeffS |
 |
|
|
harshal_in
Aged Yak Warrior
633 Posts |
Posted - 2007-05-21 : 15:52:00
|
quote: Originally posted by jsmith8858 I have no idea what you are looking for. It might be helpful if you carefully explain EXACTLY what you need.- Jeffhttp://weblogs.sqlteam.com/JeffS
Sorry..I want the difference between not null [Number] for each tempID starting with descending cycle.for example in #temp for tempid = 1select a.number- b.number from #temp a,#temp bwhere a.tempid = b.tempid and a.cycle= 3 and b.cycle=2Does this make sense?thanks for trying to help. |
 |
|
|
|
|
|
|
|