Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations Chriss Miller on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

Duplicate Records

Status
Not open for further replies.

THoey

IS-IT--Management
Jun 21, 2000
2,142
US
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...
 
Hi,
What do you mean by:

When I started running that, it took off and looked like it was dumping all TN's in the database


Dumping where?
( It may, of course, read all the records to see which match your criteria - depends on the optimizer's choice of access methods).
Have you run an explain plan?
Has the table been analyzed recenty?

[profile]

To Paraphrase:"The Help you get is proportional to the Help you give.."
 
Sorry, I was running this in SQL*Worksheet. It finished with over 6K in TN's listed. It appears to be correct. Just was concerned that I may have done it wrong.

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...
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top