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: Outer Join Problem . . .

Re: Outer Join Problem . . .

From: Hans-Peter Sloot <H.G.Sloot_at_kpn.com>
Date: 2000/05/09
Message-ID: <3917B2AB.5FA15A62@kpn.com>#1/1

Probably you cannot do a group by on t.date because you allow it to be NULL and you should group using m.name

like:

select m.name,

      nvl(count(t.field), 0)
  from tmp_months m,

      table t
where m.tag = to_char(t.date, 'MM') (+)
group by m.name

emaus081269_at_my-deja.com wrote:

> Having a problem with an outer join. Trying to get a count grouped by
> month from a date field on a table. Want to display 0 for months not
> included in the table. Created a temp table that holds each month to
> outer join too. But oracle does not seem to like outer joining when I
> am useing a function on the table I will be weak on. I can subquery
> this out and it works. Just want to know if anyone knows why or has a
> better solution.
>
> select m.name,
> nvl(count(t.field), 0)
> from tmp_months m,
> table t
> where m.tag = to_char(t.date, 'MM') (+)
> group by to_char(t.date, 'MM')
>
> This gets me a not properly ended message. Take out the outer join and
> all is well. Hmm . . .
>
> Sent via Deja.com http://www.deja.com/
> Before you buy.
Received on Tue May 09 2000 - 00:00:00 CDT

Original text of this message

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