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

Home -> Community -> Usenet -> comp.databases.theory -> Re: Simple SQL?

Re: Simple SQL?

From: Larry Coon <larry_at_assist.org>
Date: Thu, 17 May 2001 15:19:10 -0700
Message-ID: <3B044E5E.6F37@assist.org>

Goran Sliskovic wrote:

> It will return wrong result.
> before group by result set is:
>
> a b1 b2 c1 c2
> 1 1 1 1 3
> 1 1 1 1 4
> 1 1 1 1 5
> 1 2 1 1 3
> 1 2 1 1 4
> 1 2 1 1 5
>
> So it will return 3xsum(b2) and 2xsum(c2).

Then maybe...

SELECT a, SUM(b2)/COUNT(c2), SUM(c2)/COUNT(b2) FROM tblA, tblB, tblC
WHERE a = b1 AND a = c1
GROUP BY a

Larry Coon
University of California
larry_at_assist.org
and lmcoon_at_home.com Received on Thu May 17 2001 - 17:19:10 CDT

Original text of this message

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