Sunday, February 1, 2015

how to use pivot in between to select query

Try the below:(Not tested)



select COUNT( Case when DATEDIFF(minute,t.Paydate,t.DelDate) < 1 Then 1 else null end ) as OnTime ,
COUNT( Case when DATEDIFF(minute,t.Paydate,t.DelDate) > 1 Then 1 else null end) as Violate
from Transaction_tbl t where Locid=6 and Status=5




No comments:

Post a Comment