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

Home -> Community -> Usenet -> c.d.o.server -> Re: SQL

Re: SQL

From: Thomas Kyte <tkyte_at_us.oracle.com>
Date: Sat, 20 Jun 1998 01:54:21 GMT
Message-ID: <358d15f2.4688842@192.86.155.100>


A copy of this was sent to "Patrick Lanphier" <p-lanphier_at_psu.edu> (if that email address didn't require changing) On Fri, 19 Jun 1998 11:47:05 -0400, you wrote:

>Is it possible to join these two SQL statements without creating a cartesian
>join?
>
>SELECT fund, SUM(ACTUAL_HRS)
> FROM labor_to_date
> GROUP BY fund;
>
>SELECT fund, SUM(hours)
> FROM timecard
> WHERE timecard.month = 6
> GROUP BY fund;
>
>"Contracts" is a table you can use which lists all valid "fund" numbers.
>
>Patrick Lanphier
>

Inline views...

select a.fund, a.actual_hrs, b.hours
from ( select fund, SUM(ACTUAL_HRS) actual_hrs

         FROM labor_to_date
        GROUP BY fund ) a,
     ( SELECT  fund, SUM(hours) hours
         FROM timecard
        WHERE timecard.month = 6
        GROUP BY fund ) b

where a.fund = b.fund
/  

Thomas Kyte
tkyte_at_us.oracle.com
Oracle Government
Herndon VA  

http://govt.us.oracle.com/ -- downloadable utilities  



Opinions are mine and do not necessarily reflect those of Oracle Corporation  

Anti-Anti Spam Msg: if you want an answer emailed to you, you have to make it easy to get email to you. Any bounced email will be treated the same way i treat SPAM-- I delete it. Received on Fri Jun 19 1998 - 20:54:21 CDT

Original text of this message

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