Tuesday 15 March 2011

tsql - Diff b/w time in two rows in sql server -


I have a place where I need to compare time to two different rows, like this

Item_id Group Date 1 10 ABC 2008-03-07 03:02:00 1 35 BCD 2008-04-03 10:03:00 2 13 CD 2008-03-13 07:18:00 2 40 Seed 2008-03-13 08:41:00 2 44 CEF 2008-03-13 09:41:00

I have to find the time difference for row one line 2 - they fall under a cat ... and this is the continuation of it and cat 1

try it (recent Which has not been tested)

  Dated selection (day, TDAT, DDT) from diff @td Join @tt on de carrebad = T series and T. Atimid & lt; & Gt; D.itemid and datediff (day, t.date, d.date) & gt; 0  

No comments:

Post a Comment