Oracle FAQ | Your Portal to the Oracle Knowledge Grid |
![]() |
![]() |
Home -> Community -> Usenet -> c.d.o.server -> Re: Count two tables with duplicate check
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
![]() |
![]() |