Oracle FAQ | Your Portal to the Oracle Knowledge Grid |
Home -> Community -> Usenet -> c.d.o.server -> Re: Connection two select from where blocks
In article <20000220234441.09896.00000754_at_ng-fu1.aol.com>,
spotly_at_aol.comEatSpam (Spotly) wrote:
> I'm trying to get the following fields:
> ONHAND, RENTED, ONTIME, OWED...and so on from the following. I know
that the
> UNION isnt correct, but I cant seem to figure out how to do this. If
someone
> could point me in the general direct I would appreciate it. Thanks
for any
> help. Tim H.
>
> SELECT COUNT(C.DVD_CODE)-COUNT(R.DVD_CODE) AS ONHAND
> FROM DVD_COPY C, DVD_RENTAL R
> WHERE R.RENTAL_DATE IS NOT NULL
> AND R.RETURN_DATE IS NULL
> UNION
>
Spotty, I noticed is that you have no join condition in the first
statement. Don't you need a line where R.key = C.key otherwise you are
joining every row of C to every row of R.
--
Mark D. Powell -- The only advice that counts is the advice that
you follow so follow your own advice --
Sent via Deja.com http://www.deja.com/
Before you buy.
Received on Mon Feb 21 2000 - 10:50:35 CST