binto
Yak Posting Veteran
59 Posts |
Posted - 2013-09-25 : 06:02:38
|
Hi,create table #prints(id int IDENTITY(1,1) NOT NULL, Printermarkersupplyid varchar(36),PrinterID varchar(10),Description varchar(10),SupplyLevel int,ModifiedDate datetime)insert into #prints(Printermarkersupplyid,PrinterID,Description,SupplyLevel,ModifiedDate)select newid(),'P1','D1',100,'2013-08-1 03:28:38.203'union allselect newid(),'P1','D1',0,'2013-8-2 03:28:38.203'union allselect newid(),'P1','D1',100,'2013-8-3 03:28:38.203'union allselect newid(),'P1','D1',80,'2013-8-4 03:28:38.203'union allselect newid(),'P1','D1',0,'2013-8-5 03:28:38.203'union allselect newid(),'P1','D1',100,'2013-8-6 03:28:38.203'union allselect newid(),'P1','D2',80,'2013-8-7 03:28:38.203'union allselect newid(),'P1','D2',0,'2013-8-8 03:28:38.203'union allselect newid(),'P1','D2',0,'2013-8-9 03:28:38.203'union allselect newid(),'P1','D2',80,'2013-8-10 03:28:38.203'union allselect newid(),'P1','D2',70,'2013-8-11 03:28:38.203'my requirement is to get the difference between adjacent rows.ie difference between 2nd and 3rd or 6th and 7th but not 6th and 8th.if difference between 2nd and 3rd is less than zero and 3rd modified date > 2nd modified date,then i should get count as 1 against 3rd row.Thanks,BintoThanks & RegardsBinto Thomas |
|