Quantcast
Channel: SQLServerCentral » SQL Server 2014 » Administration - SQL Server 2014 » Latest topics
Viewing all articles
Browse latest Browse all 6525

T-SQL- find the simultaneously processing events

$
0
0
This is a tricky one (for me anyways). Would appreciate any ideas on how to do this most effciently.Let's say I have a table defined as:Create table queue (id int identity, starttime datetime, finishtime datetime)each id represents some event and I want to find the maximum number of events which were simultaneously in progress.for example in the data set like this:1, Jan-1, Jan-52, Jan-2, Jan-43, Jan-3, Jan-34, Dec-1,Dec-25, Dec-1,Dec-16, Feb-1, Feb-17, Jan-6, Jan-7The answer would be 3, as the first three events were all in progress on Jan-3.This is a very simple example, but I would need to solve this for a huge queue table with precise dates and times.

Viewing all articles
Browse latest Browse all 6525

Trending Articles