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

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 (view raw or flat)
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

pgsql-novice by date

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

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