I need to find out a list of mobiles who have been contacted thrice over a period of two days using columns like mobile and call_time?
From my understanding, I have tried using below code, by using self-join it will match similar mobile numbers and I need to find out if a mobile repeated thrice or more but I also need to find out difference between the maximum and minimum call time for a particular customer to see if it is less than two days. Do let me know how to implement that logic:
select c1.mobile
from call_Records c1, call_Records c2
where c1.mobile=c2.mobile and max(call_time)-min(call_time)<=2
I would want data to be like:
Customer Mobile
XXXXX0001
XXXXX0002
XXXXX0003