Re: Help with SQL Puzzle..?

From: L Carl Pedersen <l.carl.pedersen_at_dartmouth.edu>
Date: Fri, 03 Feb 1995 22:59:16 -0500
Message-ID: <l.carl.pedersen-0302952259160001_at_kip-1-sn-350.dartmouth.edu>


In article <3gmrv0$fnp_at_pipe1.pipeline.com>, qmick_at_pipeline.com (Michael Joseph) wrote:

>I am trying to write a one line piece of SQL to return the following data
>
>TABLESPACE FREE SPACE USED SPACE
>
>SYSTEM 10000000 2000000
>UTILS 5000000 3000000
>
>etc.
>
>I have tried this with:
>
>SELECT F.TABLESPACE_NAME, SUM(F.BYTES), SUM(U.BYTES)
>FROM SYS.DBA_FREESPACE F, SYS.DBA_SEGMENTS U
>WHERE F.TABLESPACE_NAME=U.TABLESPACE_NAME
>GROUP BY F.TABLESPACE_NAME
>
>But I get incorrect results coming back.....
>
>How do I make this work...?

you are getting cartesian explosion because both of those things have more than one row for each tablespace. use sub-views that collapse free space and used space by tablespace. Received on Sat Feb 04 1995 - 04:59:16 CET

Original text of this message