View Single Post
  #2  
Old 03-26-2015, 04:31 AM
hergenmuelle hergenmuelle is offline
Hot Shot
.
 
Join Date: Jul 2012
Posts: 20
hergenmuelle has 13 reputation pointshergenmuelle has 13 reputation points
Default

One way to do that:
select Originator, CountOf from (select distinct Originator, count(Originator) as CountOf from dbo.eCSRStat WHERE {fn TIMESTAMPDIFF(SQL_TSI_HOUR,LastTreatmentStamp, CURRENT_TIMESTAMP)} <= 700 group by Originator ) where CountOf > 1

=> show all Originators occurring more than once within the last 700 hours.
This is just an example and can be enhanced if required.
Reply With Quote