Oracle FAQ Your Portal to the Oracle Knowledge Grid
HOME | ASK QUESTION | ADD INFO | SEARCH | E-MAIL US
 

Home -> Community -> Usenet -> c.d.o.server -> Re: SQL query help

Re: SQL query help

From: Donna Hormozian <zero_at_interlog.com>
Date: 2 Mar 1999 18:55:27 GMT
Message-ID: <01be64de$206bb700$450214d1@Kurosh_home.vpi.com>


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

Original text of this message

HOME | ASK QUESTION | ADD INFO | SEARCH | E-MAIL US