Re: Query Help

From: Stephan Szabo <sszabo(at)megazone23(dot)bigpanda(dot)com>
To: shreedhar <shreedhar(at)lucidindia(dot)net>
Cc: Postgre General <pgsql-general(at)postgresql(dot)org>
Subject: Re: Query Help
Date: 2003-03-29 15:53:16
Message-ID: 20030329074800.I10874-100000@megazone23.bigpanda.com
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: pgsql-general


On Sat, 29 Mar 2003, shreedhar wrote:

> Using this query I am expecting result as
>
> year month totalreported closederrors openerrors fixederrors
> 2002 1 31 29 2
>
> 2002 2 85 60 25
>
> 2002 3 16 12 4
> 2002 5 41 29 12
> 2002 7 48 48
> 2002 8 1 1
> 2002 10 51 51
> 2002 11 69 15 54
> 2002 12 8 8
>
> 2003 1 9 9
>
> 2003 2 38 38
>
>
>
> But Retreiving result as
>
> year month totalreported closederrors openerrors fixederrors
> 2002 1 31 29 2
> 2002 1 31 29 9
> 2002 2 85 60 25
> 2002 2 85 60 38
> 2002 3 16 12 4
> 2002 5 41 29 12
> 2002 7 48 48
> 2002 8 1 1
> 2002 10 51 51
> 2002 11 69 15 54
> 2002 12 8 8
> 2003 1 9 29 2
> 2003 1 9 29 9
> 2003 2 38 60 25
> 2003 2 38 60 38
>
>
>
> I mean I values retreives across years data is repeating.
>
> May I know how can I get expected results by above query.

Hmm, what version are you using and what are the definitions of the tables
and what do the component subselects generate? I don't see anything
obviously wrong (although I'd think that the distinct clauses are
unnecessary with the group by), so I could have missed something or you
could be hitting a bug, but without something to plug in to try with it's
hard to tell.

In response to

  • Query Help at 2003-03-29 07:42:50 from shreedhar

Responses

Browse pgsql-general by date

  From Date Subject
Next Message Peter Csaba 2003-03-29 16:03:17 Rules / Triggers something a little bit more chellanging
Previous Message Bruce Momjian 2003-03-29 15:34:50 Re: DROP LANGUAGE error in pg_dump?