Question : SQLPLUS questio

I have the following SELECT statement in sqlplus which is looking for duplicate records in my db.

select distinct (pyid) from (select pyid, count (0)
    from pca_work group by pyid having count (0)>1);

The select functions fine.  The problem is that it seems to run twice and produces the output twice.

Looks something like this:


3 rows selected

Elapsed: 00:06:02.29
S-100512-007235
S-100611-005877
S-100614-008119

3 rows selected

Elapsed: 00:05:23.30


So how do I keep it from running twice...

Thanks,

John

Answer : SQLPLUS questio

That should not run twice.  Perhaps you are putting an extra / in after the query that would make it run twice.

Also, I believe this is a simpler version of what you are doing:

select pyid from pca_work group by pyid having count(1) > 1;

The distinct is not necessary, they are already distinct because of the group by.
Random Solutions  
 
programming4us programming4us