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 |
raxbat
Yak Posting Veteran
52 Posts |
Posted - 2008-02-21 : 01:47:36
|
Hello friends!Help me please to construct sucha a query:I have a list of processes, each of them has a value! I need to compere each process with every anather process.Example:Process Value1 0.12 0.1053 0.094 0.09 I need to get the following result of a query:Process1 Process2 Value_delta1 2 0.051 3 0.011 4 0.012 3 0.015....Thank You! |
|
harsh_athalye
Master Smack Fu Yak Hacker
5581 Posts |
Posted - 2008-02-21 : 04:25:11
|
how is value delta calculated?Harsh AthalyeIndia."The IMPOSSIBLE is often UNTRIED" |
 |
|
SwePeso
Patron Saint of Lost Yaks
30421 Posts |
Posted - 2008-02-21 : 06:28:07
|
[code]DECLARE @Sample TABLE (Process TINYINT, Value SMALLMONEY)INSERT @SampleSELECT 1, 0.100 UNION ALLSELECT 2, 0.105 UNION ALLSELECT 3, 0.090 UNION ALLSELECT 4, 0.090SELECT s1.Process, s2.Process, ABS(s1.Value - s2.Value) AS DeltaFROM @Sample AS s1INNER JOIN @Sample AS s2 ON s2.Process > s1.Process[/code] E 12°55'05.25"N 56°04'39.16" |
 |
|
|
|
|