<table> Date In Out ??? 10/26/2012 16:29:26 16:29:29 10/26/2012 16:31:21 16:31:25 0:01:52 10/26/2012 16:49:40 16:49:48 0:18:15 </table>
SELECT TOP 2 Out,In FROM tbl ORDER BY Out DESC
SELECT Date ,In ,Out ,CONVERT(varchar, In - (SELECT MAX (OUT) FROM Table RD WHERE RD.OUT< MD.OUT AND RD.Date = MD.Date GROUP BY Date ), 108 ) [???] FROM Table MD
var
This content, along with any associated source code and files, is licensed under The Code Project Open License (CPOL)