Oracle FAQ | Your Portal to the Oracle Knowledge Grid |
![]() |
![]() |
Home -> Community -> Usenet -> c.d.o.server -> Re: SQL query help
Try using a decode. If the prec is 'Snow', choose 1. If the prec is other
than 'Snow' ('Rain' or null), choose 0.
Then do a sum of the decode to simulate the count.
select sa_states.state, sa_states.area, sum(decode(sa_stat.prec, 'Snow', 1,
0)) snow
from sa_stat, sa_states
where sa_states.state = sa_stat.state (+)
group by sa_states.area, sa_states.state
State Area Snow CO West 0 GA South 1 HI West 0 IN North 2 NY North 0 TX South 1
Hope this helps.
Kurosh Hormozian
Visioneering Partners Inc.
kurosh_at_visioneeringpartners.com
Pete <pmarkey_at_bellsouth.com> wrote in article
<aGIC2.148$JS4.75_at_news1.atl>...
> I need some help with this query problem:
> All responses greatly appreciated.
>
Received on Tue Mar 02 1999 - 12:55:27 CST
![]() |
![]() |