Re: Query Help - Mailing list pgsql-general

From Stephan Szabo
Subject Re: Query Help
Date
Msg-id 20030329074800.I10874-100000@megazone23.bigpanda.com
Whole thread Raw
In response to Query Help  ("shreedhar" <shreedhar@lucidindia.net>)
Responses Select aliasses in where and other places of the selectlist?  (Arjen van der Meijden <acm@tweakers.net>)
List 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.


pgsql-general by date:

Previous
From: Bruce Momjian
Date:
Subject: Re: DROP LANGUAGE error in pg_dump?
Next
From: Peter Csaba
Date:
Subject: Rules / Triggers something a little bit more chellanging