Skip to content
Advertisement

Find repeating phone numbers between a 7 day range

I have a phone and a call date field. I need to find all phone and call dates where calls were made more than once (>1) within a 7 day period.

What is the best approach to this?

Example:

output:

Here’s an example query I tried but I assume I can do better (besides, its taking a very long time, over 1 million records):

Advertisement

Answer

You seem to want lead() and lag() to compare the calldate on one row to the nearest calldate before or after:

User contributions licensed under: CC BY-SA
4 People found this is helpful
Advertisement