May 31, 2016 at 8:04 am
Dear All,
My requirement is to calculate the failure time, I just want to know the difference in hours where the status is 'I' and it shouldnt calculate if status is A
CREATE TABLE [dbo].[Temp2](
[SiteCode] [int] NULL,
[StatusTime] [datetime] NULL,
[Status] [char](2) NULL
) ON [PRIMARY]
GO
SET ANSI_PADDING OFF
GO
insert into Temp2 values(111,'2016-05-30 13:02:00.000','A')
insert into Temp2 values(111,'2016-05-30 14:02:00.000','I')
insert into Temp2 values(111,'2016-05-30 15:02:00.000','I')
insert into Temp2 values(112,'2016-05-30 19:17:00.000','A')
insert into Temp2 values(112,'2016-05-30 21:02:00.000','I')
insert into Temp2 values(112,'2016-05-30 23:02:00.000','I')
Consider I as InActive and A as Active, So if i pull the records for 'I' then the Result is expected for the code 111 is 1 Hour as and for the code 112 its 2 hours, My real scenario is different I just put sample table and records
Please help me
May 31, 2016 at 8:08 am
I gave response on your other thread.....please dont double post
http://www.sqlservercentral.com/Forums/FindPost1790784.aspx
________________________________________________________________
you can lead a user to data....but you cannot make them think
and remember....every day is a school day
May 31, 2016 at 8:12 am
Sorry,
I replied back
June 2, 2016 at 6:24 am
you got the answer or you are still looking for the answer
June 2, 2016 at 7:16 pm
subramanian.esakkimuthu 40485 (6/2/2016)
you got the answer or you are still looking for the answer
Please use the other thread that JLS provided. This one is a duplicate..
--Jeff Moden
Change is inevitable... Change for the better is not.
Viewing 5 posts - 1 through 4 (of 4 total)
You must be logged in to reply to this topic. Login to reply