score:0

timespan output = new timespan(0,0,0);
using (var enumerator = input.getenumerator())
{
    while (enumerator.movenext())
    {
      var begin = enumerator.current.clockinouttime;
      if(!enumerator.movenext())
        break;

      var end = enumerator.current.clockinouttime;
      output += (end - begin);
    }
}

score:2

  select (select sum(datediff(second,[clockinouttime], getdate()))
     from [swp].[dbo].[table_1] t1
     where [in/out] = 'in'
     and t1.[user] = t.[user]) -
     coalesce((select sum(datediff(second,[clockinouttime], getdate()))
     from [swp].[dbo].[table_1] t2
     where [in/out] = 'out'
     and t2.[user] = t.[user]),0)
  from [swp].[dbo].[table_1] t   
  group by [user]

Related Query

More Query from same tag