Re: selecting counts from two different tables

From: Lawrence James <James.Lawrence_at_epamail.epa.gov>
Date: Thu, 27 Oct 1994 18:56:41 GMT
Message-ID: <James.Lawrence.24.000DF245_at_epamail.epa.gov>


In article <38jdt9INNbe_at_life.ai.mit.edu> cracraft_at_quaker-oats.ai.mit.edu (Stuart Cracraft) writes:
>From: cracraft_at_quaker-oats.ai.mit.edu (Stuart Cracraft)
>Subject: selecting counts from two different tables
>Date: 25 Oct 1994 17:05:45 GMT

>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.
 

>How can I do this in SQL*Plus?
 

>Please reply to cracraft_at_ai.mit.edu.

You can't in a single SQL statement but you can in sqlplus

COLUMN Z NEW_VALUE X NOPRINT
SELECT 100 Z FROM DUAL;
SELECT 1000, 1000/&&X, &&X FROM DUAL; The &&x is a substitution variable passed from the first statement. Substitute more meaningful label at your leasure. Received on Thu Oct 27 1994 - 19:56:41 CET

Original text of this message