Re: selecting counts from two different tables
From: Craig L Hollister <Craig.Hollister_at_DaytonOH.NCR.COM>
Date: Fri, 28 Oct 1994 16:37:57 GMT
Message-ID: <CyE679.424_at_wtc35a.DaytonOH.NCR.COM>
Date: Fri, 28 Oct 1994 16:37:57 GMT
Message-ID: <CyE679.424_at_wtc35a.DaytonOH.NCR.COM>
>In article <38jdt9INNbe_at_life.ai.mit.edu> Stuart Cracraft writes:
>
>I have two tables "A" and "B". I want to select a distinct count
>based on one column from A (call it "a") and a count of all rows
>from B, calculate an average of the latter divided by the former,
>and output the three values (count of A, count of B, B/A) in
>a SINGLE ROW.
I don't think you can do it without creating some views:
Create view AA as
select count (distinct a) aa from A;
Create view BB as
select count (*) bb from B;
Select aa, bb, bb/aa
from AA, BB;
Received on Fri Oct 28 1994 - 17:37:57 CET