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]
Source: stackoverflow.com
Related Query
- How to calculate total working time in LINQ?
- calculate the total time grouping by date and id using linq
- How to calculate a running total using linq
- How to calculate STD dev and Average with linq and entity framework at the same time
- how to update the multiple rows at a time using linq to sql?
- How to calculate sum of a DataTable's Column in LINQ (to Dataset)?
- How can I select items with Linq by Date while ignoring Time portion of a DateTime property?
- LINQ - using a query expression to calculate data time difference
- How can I calculate sum of column value in linq to sql query?
- How to truncate time part from date in linq query?
- LINQ - Get total query results time
- How can I use LINQ to calculate the longest streak?
- Linq Paging - How to incorporate total record count
- How do I calculate a checksum on all columns in a row using LINQ and Entity Framework?
- How to calculate changes of nullable numbers with Linq
- How to: sum all values and assign a percentage of the total in Linq to sql
- How to filter a list with linq depends on counting a property at the same list and take a random group at least minimum total
- Use linq to provide a running total of how many users existed by date
- How to Group and or Select in Linq based on a running total
- How to calculate count on of table column using group by clause in linq
- How to measure the time for LINQ Query?
- How do you write a LINQ query that filters a sub table to a specific time period and sums the results of the sub table?
- Calculate elapsed time in a linq query
- How to force Linq to update last edit time of a row?
- LINQ not working in Views. Any ideas how to fix this?
- How to remove time portion from Nullable<DateTime> in LINQ
- How do I write a linq select statement without knowing at design time the names of the properties I'm going to select?
- How can I convert my working SQL query to Linq (C#)?
- C# SQL Statement transformed TO LINQ how can i translate this statement to a working linq
- How can I remove the time part from a nullable datetime in where condition of Linq
More Query from same tag
- How to have a list with separate attributes instead of having the whole list under a single attribute
- From "LINQ to SQL" to "Azure Table Storage" or "SQL Data Service"
- EF6: Collection was modified, enumeration operation may not execute
- Linq query to fill complex model?
- HtmlAgilityPack SelectNode doesn't works on WP8.1
- select single or multiple records using a single linq query
- LINQ Growth Chart
- Select Subset in Linq
- Range variable name cannot match the name of a member of the 'Object' class. when querying a DataGridView using Linq
- Merge Date Ranges Linq to SQL
- Generic Repository Linq2Sql impedence mismatch problem
- XML parse check if attribute exist
- How to set date format "yyyy-MM-dd hh:mm" in linq?
- How to build object hierarchy for serialization with json.net?
- LINQ query returning null when requesting bytes
- LINQ Keywords vs. Methods
- c# linq sql coalesce conversion
- C# cannot equal '&' with entityframework data
- Linq Elements Attribute string list
- Iterating result of Linq query
- "Processing of the LINQ expression 'GroupByShaperExpression" Got error after upgrade to ef core . 5
- Search Xml file with Linq, get nodes that match to subnodes
- Creating a dictionary by setting a list of type string to a dictionary
- Entity Framework LINQ SelectMany exception
- Convert List<A> to List<B> with Linq c#
- Find duplicate in a list from a reference list
- how to parse this Xml type string
- I want take the last 4 record but always get the first 4
- C# LINQ use linq query write double for loop function
- What Linq to Entities statement tells me if a particular child entity exists?