Oracle FAQ | Your Portal to the Oracle Knowledge Grid |
![]() |
![]() |
Home -> Community -> Usenet -> c.d.o.misc -> Re: count record from two tables with duplicate check
select count(*) from (select aaa from a union all select aaa from b) group
by aaa having count(*) > 1
<MHakimjavadi_at_gmail.com> wrote in message
news:1126658669.080666.261930_at_z14g2000cwz.googlegroups.com...
> 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 count(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
>
Received on Wed Sep 14 2005 - 06:44:41 CDT
![]() |
![]() |