| Oracle FAQ | Your Portal to the Oracle Knowledge Grid | |
Home -> Community -> Usenet -> comp.databases.theory -> Re: Simple SQL?
Larry Coon <larry_at_assist.org> wrote in message news:3B044E5E.6F37_at_assist.org...
> 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
Still no good :).
Now it will return 1/2sum(b2) and 1/3sum(c2).
if you really want to do it without subquery, and tables have primary keys
(and they should):
SELECT a, SUM(b2)/COUNT(*)*count(distinct tblB.pk),
SUM(c2)/COUNT(*)*count(distinct tblC.pk)
FROM tblA, tblB, tblC
WHERE a = b1 AND a = c1
GROUP BY a
I guess this should work... too lazy to check it.
Goran Received on Fri May 18 2001 - 03:02:41 CDT
![]() |
![]() |