Skip site navigation (1) Skip section navigation (2)

Re: [SQL] JOIN

From: "Loredana Curugiu" <loredana(dot)curugiu(at)gmail(dot)com>
To: "Richard Huxton" <dev(at)archonet(dot)com>, pgsql-novice(at)postgresql(dot)org, pgsql-sql(at)postgresql(dot)org
Subject: Re: [SQL] JOIN
Date: 2007-06-05 12:18:18
Message-ID: 1c23c8e70706050518v19c56d21j873985125b930db@mail.gmail.com (view raw or flat)
Thread:
Lists: pgsql-novicepgsql-sql
>> So  I have the following query:>>

> >>        SELECT SUM(A.count),
> >>                      A.theme,
> >>                      A.receiver,
> >>                      A.dates
> >>           FROM my_table A
> >> INNER JOIN my_table B
> >>               ON A.theme=B.theme
> >>             AND A.receiver=B.receiver
> >>             AND A.date=ANY(B.dates)
> >>  GROUP BY A.theme,A.receiver, A.dates;
> [snip]
> >>
> >> The result is wrong. I don't know what it is wrong at my query.
> >> Please help.
>
> You don't actually say what's wrong. What are you expecting as output?


I am trying to say that sum column it is not calculated correctly.

Oh, and your "date" column isn't - it's a timestamp with time-zone. That
> might or might not cause confusion with daylight-saving-times.


Yes, I am working with timestamp with time zone .


Regards,
        Loredana

In response to

  • Re: JOIN at 2007-06-05 12:13:46 from Richard Huxton

Responses

  • Re: JOIN at 2007-06-05 12:39:29 from Richard Huxton
  • Re: JOIN at 2007-06-05 12:45:19 from Gregory Stark

pgsql-novice by date

Next:From: Richard HuxtonDate: 2007-06-05 12:39:29
Subject: Re: JOIN
Previous:From: Richard HuxtonDate: 2007-06-05 12:13:46
Subject: Re: JOIN

pgsql-sql by date

Next:From: Richard HuxtonDate: 2007-06-05 12:39:29
Subject: Re: JOIN
Previous:From: Richard HuxtonDate: 2007-06-05 12:13:46
Subject: Re: JOIN

Privacy Policy | About PostgreSQL
Copyright © 1996-2014 The PostgreSQL Global Development Group