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

Home -> Community -> Usenet -> c.d.o.misc -> Re: subqueries?

Re: subqueries?

From: Klaus Schuermann <Klaus.Schuermann_at_gmx.de>
Date: Wed, 12 Jan 2000 20:16:17 -0000
Message-ID: <85ijms$102$1@news04.btx.dtag.de>


Hi,
you can use your 2 queries as views.
Try this:

select a.id, a.column1, a.column2,

       b.column1, b.column2
from (select id, sum(column1) column1,

                 sum(column2) column2
        from table1
       group by id) a,
     (select id, sum(column1) column1,
                 sum(column2) column2
        from table2
       group by id) b

where a.id = b.id;

Klaus

Richard Price <explore65_at_yahooo.com> schrieb in im Newsbeitrag: 204f4.53$kB3.3225_at_news.uswest.net...
> I have two SELECT statements built that each produce nice 2 column result
> sets. ( they are separate because they perform GROUP BY results
> differently) . How can I combine them with SQL? They each have an ID
field
> in common. I'd like to have a resulting table with the common ID and the
two
> attributes from each result set.
>
> It doesn't seem possible to build an over all SELECT statement that has a
> FROM clause that uses another SELECT statement as a target.
>
> Any ideas would be wonderful to hear. Also, is there another news group
> that would be more appropriate for this?
>
> Thanks!
> Richard
>
>
>
>
Received on Wed Jan 12 2000 - 14:16:17 CST

Original text of this message

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