Oracle FAQ | Your Portal to the Oracle Knowledge Grid |
Home -> Community -> Usenet -> c.d.o.misc -> Re: 2 select(count(*)) in a query
the next step is easy:
SELECT SUM(x) from (select count(*) x from aaguser
union all select count(*) x from audit_trail ) ;
Niall Litchfield wrote:
> Doesn't work
>
> SQL> select count(*) from aaguser
> 2 union all
> 3 select count(*) from audit_trail;
>
> COUNT(*)
> ----------
> 2971
> 21
>
> --
> Niall Litchfield
> Oracle DBA
> Audit Commission UK
> "Rene Nyffenegger" <rene.nyffenegger_at_gmx.ch> wrote in message
> news:a6d06107.0109210641.29250850_at_posting.google.com...
> > >
> > > I've got 2 tables and I ask to myself if we can count total elements of
> > > the 2 tables in one query
> > >
> > > Ex : select count(*) from A + select count(*) from B.
> >
> >
> > select count(*) from a union all select count(*) from b
> >
> > hth
> > Rene
Received on Sun Sep 30 2001 - 22:25:19 CDT