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.

 All Forums
 SQL Server 2005 Forums
 Transact-SQL (2005)
 "how do i" different calculate

Author  Topic 

attman
Starting Member

16 Posts

Posted - 2009-12-23 : 10:55:27

yosiasz
Master Smack Fu Yak Hacker

1635 Posts

Posted - 2009-12-23 : 11:31:05
are there always only 2 rows for each device? or could there be more than 2 rows for each device!

<><><><><><><><><><><><><><><><><><><><><><><><><>
If you don't have the passion to help people, you have no passion
Go to Top of Page

attman
Starting Member

16 Posts

Posted - 2009-12-23 : 11:55:10
Yes, be more than 2 rows for each device
Go to Top of Page

yosiasz
Master Smack Fu Yak Hacker

1635 Posts

Posted - 2009-12-23 : 14:23:02
so do you want the difference between the last two recorded rows for each device or you want the difference between all rows for each device? also can a new row for a device be less than a previous row with smaller datetime stamp?
[code]
id date_stamp devide_id value_1
1 23.12.2009 17:37 101 8
2 23.12.2009 18:37 101 22
2 23.12.2009 19:37 101 10
[code]

<><><><><><><><><><><><><><><><><><><><><><><><><>
If you don't have the passion to help people, you have no passion
Go to Top of Page
   

- Advertisement -