I have a table with about four millions records in it. This is a call history table and tracks the customers phone number (TN), the date they called, and some other data. I am trying to write a query to pull out all TN's where a customer has called X number of times within a certain time period.
I did a search here and Carp had provided a find duplicates query that I modified to the following:
SELECT TN
FROM CALL_HISTORY
WHERE CALL_DATE > TRUNC(SYSDATE - 30)
GROUP BY TN
HAVING count(*) > 5;
When I started running that, it took off and looked like it was dumping all TN's in the database.
Can anyone see anything wrong with it?
Terry
**************************
* General Disclaimer - Please read *
**************************
Please make sure your post is in the CORRECT forum, has a descriptive title, gives as much detail to the problem as possible, and has examples of expected results. This will enable me and others to help you faster...
I did a search here and Carp had provided a find duplicates query that I modified to the following:
SELECT TN
FROM CALL_HISTORY
WHERE CALL_DATE > TRUNC(SYSDATE - 30)
GROUP BY TN
HAVING count(*) > 5;
When I started running that, it took off and looked like it was dumping all TN's in the database.
Can anyone see anything wrong with it?
Terry
**************************
* General Disclaimer - Please read *
**************************
Please make sure your post is in the CORRECT forum, has a descriptive title, gives as much detail to the problem as possible, and has examples of expected results. This will enable me and others to help you faster...