Re: Fw: Count rows group by time intervals

From: "Oliveiros Cristina" <oliveiros(dot)cristina(at)marktest(dot)pt>
To: "Loredana Curugiu" <loredana(dot)curugiu(at)gmail(dot)com>, <pgsql-novice(at)postgresql(dot)org>
Subject: Re: Fw: Count rows group by time intervals
Date: 2007-05-10 11:03:30
Message-ID: 006201c792f2$d7c01860$ec5a3d0a@marktestcr.marktest.pt
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: pgsql-novice

Yes,I've already figured out the mistake.
Can you please try this one?
Please Tell me if it worked

SELECT a."date",a."theme",a.receiver,COUNT(*)
FROM (SELECT DISTINCT * FROM t_loredana) a
INNER JOIN t_loredana b
ON a."theme" = b."theme" AND a.receiver = b.receiver
WHERE (((b."date" - a."date") = 1) OR (b."date" - a."date") = 0)
GROUP BY a."date",a."theme",a.receiver
HAVING (a."date" - '2007-01-01' ) % 2 = 0
ORDER BY a."date"
----- Original Message -----
From: Loredana Curugiu
To: Oliveiros Cristina ; pgsql-novice(at)postgresql(dot)org
Sent: Thursday, May 10, 2007 8:15 AM
Subject: Re: Fw: [NOVICE] Count rows group by time intervals

Hi Oliveiros,

With your query I get the following result

date | theme | receiver | count
------------------------------------+----------+----------------------+-------
2007-04-27 00:00:00+00 | MIA | +40741775621 | 25
2007-04-25 00:00:00+00 | LIA | +40741775621 | 50
2007-05-09 00:00:00+00 | MIA | +40741775621 | 1
2007-04-27 00:00:00+00 | LIA | +40741775621 | 81

The count it is not correct.

Best,
Loredana

In response to

Responses

Browse pgsql-novice by date

  From Date Subject
Next Message Loredana Curugiu 2007-05-10 11:40:22 Re: Fw: Count rows group by time intervals
Previous Message Loredana Curugiu 2007-05-10 08:01:03 Count rows by day interval