Re: Another SQL question
From: Amine Y. Tarhini <atarhini_at_ringer.cs.utsa.edu>
Date: 1996/07/30
Message-ID: <4tli0v$3nc_at_ring01.cs.utsa.edu>#1/1
Date: 1996/07/30
Message-ID: <4tli0v$3nc_at_ring01.cs.utsa.edu>#1/1
(Mr. John C. Flack) writes:
>Try doing this:
>
[deleted for brevity]
>
>OR in Oracle 7.2 and beyond:
>select year, car, color, sum(car_count)
> from (select year, car, color, 0 car_count
> from yr_model, cars
> where year=94
> union
> select year, car, color, 1
> from inventory
> where year=94)
> group by year, car, color;
This one worked beautifully and gave me the performance I was looking for. a couple of notes:
- In the second inner select, I needed a "COUNT(field) car_count" instead of "1"
- I needed a group by clause for that same select statement, as well as for the outer select. Thanks a lot for the help. -- Amine. atarhini_at_ringer.cs.utsa.edu
The above views are mine only ... etc. etc. Received on Tue Jul 30 1996 - 00:00:00 CEST