I have some bills keep circulating in our BillWorkflow table. I have to pick only those Bills.
Almost every bill will hit this ProcessorId, ProcessorBinId and StateId.
But i want the bills which are keep circulating (occured more than 5 times) and it is on top 1 record with ProcessorId = 300, ProcessorBinid = 50 and StateId = 38.
select distinct BillId from Billworkflow
where ProcessorID = 300
and ProcessorBinID = 50
and StateID = 38
and TimeStmp >= '08/30/2015'
How should i pick only those distinct bill id's