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: Thomas Bartos <thomas_at_bartos.com>
Date: Tue, 2 Mar 1999 00:34:09 -0800
Message-ID: <7bg7tl$6eg0$1@newssvr03-int.news.prodigy.com>


Pete,
It wasn't entirely clear from your message what you wanted, so I guessed that you wanted your output to be similar to what you are getting now, except that states without snowfall should appear in the output. So I used the vull value function with a default of 0 to display states that didn't have any weather reported, then summed up the total number of snowy days using the decode.

... hope this helps, but let me know if you needed something entirely different.

Select sa_states.state, sa_states.area,   nvl(sum(decode(sa_stat.prec, 'Snow', 1, 'Rain', 0 )),0) as snow from sa_states, sa_stat
where sa_states.state = sa_stat.state(+) group by sa_states.area, sa_states.state order by sa_states.area;

-Tom Received on Tue Mar 02 1999 - 02:34:09 CST

Original text of this message

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