I am trying to create a query to provide me with the turnaround time in minutes of a number of rows of testing data.
A succinct version of the table is:
TestName, StartDateTime, EndDateTime
And I am looking for a query that can give me a output something like:
Distinct TestName
, StartDate[not time]
, Count(rows) as Total
, Count(rows where datediff(minute, StartDateTime, EndDateTime) <=60) as NonBreach
, Count(rows where datediff(minute, StartDateTime, EndDateTime) >60) as Breach
, Count(rows where datediff(minute, StartDateTime, EndDateTime) >60) / Count(rows) as BreachRate
Is this principle even possible?
Any direction would be greatly appreciated.
You could use something like this:
Although depending on your DBMS you may need to use a different method of removing the time from the date.
Removing time from date:
SQL-Server 2008 and later:
SQL-Server 2005 and Earlier
MySQL & SQLite
Oracle
Postgresql