Oracle FAQ Your Portal to the Oracle Knowledge Grid
HOME | ASK QUESTION | ADD INFO | SEARCH | E-MAIL US
 

Home -> Community -> Usenet -> c.d.o.server -> Re: Count two tables with duplicate check

Re: Count two tables with duplicate check

From: Jaap W. van Dijk <j.w.vandijk.removethis_at_hetnet.nl>
Date: Sat, 17 Sep 2005 10:13:30 +0200
Message-ID: <81kni1l6laik3hiol3isc7a6a2pt5e817g@4ax.com>


On 13 Sep 2005 17:42:18 -0700, MHakimjavadi_at_gmail.com wrote:

>Hi
>
>I need to count the number record in two tables with duplicate check,
>so I have:
>
>Table a - X
> Y
> Z
>
>Table B X
> W
> K
>
>The query should return 5 because recode X is duplicate. I tried like
>this:
>
>Select (DISTINCT AAA) from
> (Select emp_num AAA from A
> union all
> Select emp_num AAA from B)
>
>and it is working fine but very slow. Please advice.
>
>Thanks

As soon as you start deduplicating, Oracle has to sort the records to get the duplicates together, whichever way you code your query. If you got a lot of data, this will be inherently slow.

Jaap. Received on Sat Sep 17 2005 - 03:13:30 CDT

Original text of this message

HOME | ASK QUESTION | ADD INFO | SEARCH | E-MAIL US