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: Steve Dyrdahl <dyrdahl_at_nixon.reticular.com>
Date: Wed, 12 Jan 2000 11:21:13 -0800
Message-ID: <Pine.GSO.4.05.10001121114210.11936-100000@nixon.reticular.com>


This is not particulary pretty or efficient, but I it should do what you want.

SELECT t1.primarykey,
       t1.value1,
       t1.value2,
       t2.value1,
       t2.value2
  FROM (   SELECT value1, value2
             FROM table1
            WHERE ...
         GROUP BY ...
       ) t1,
       (   SELECT value1, value2
             FROM table2
            WHERE ...
         GROUP BY ...
       ) t2

 WHERE t1.primarykey = t2.primarykey

On Wed, 12 Jan 2000, Richard Price wrote:

> 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 - 13:21:13 CST

Original text of this message

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