Re: Fw: Count rows group by time intervals

Поиск
Список
Период
Сортировка
От Oliveiros Cristina
Тема Re: Fw: Count rows group by time intervals
Дата
Msg-id 00f301c79308$4dfbd680$ec5a3d0a@marktestcr.marktest.pt
обсуждение исходный текст
Ответ на Fw: Count rows group by time intervals  ("Oliveiros Cristina" <oliveiros.cristina@marktest.pt>)
Список pgsql-novice
Hello, Loredana.
 
Great to hear about the progress!!
 
Well, that part of the condition is to select the day, or the day after.
 
with the condition  ((a."date" - '2007-01-01' ) % 2 = 0 you obtain just the
even days, correct?
 
Then with the WHERE clause you are selecting, for a certain even day, all the records that match that day and the day after,  got the idea?
 
Then all you have to do it is COUNT them.
 
If it is to allow the time interval to vary, say you have a number of days of x.
 
Then you should change the HAVING clause to ((a."date" - '2007-01-01' ) % x = 0 ,
and change the WHERE clause to something like WHERE (((b."date" - a."date") >= 0) OR (b."date" - a."date") < x)
 
Try this, and please let me know if it solved the problem.
 
I use C# to access postgres database and it is very easy to parameterize a query with the NpgsqlParameter class.
 
I don't know if you are also using C# to interface with your database....
 
Take care
 
La revedere ,
 
Oliveiros :-)

 
----- Original Message -----
Sent: Thursday, May 10, 2007 12:40 PM
Subject: Re: Fw: [NOVICE] Count rows group by time intervals

On 5/10/07, Oliveiros Cristina <oliveiros.cristina@marktest.pt> wrote:
Yes,I've already figured out the mistake.
Can you please try this one?
Please Tell me if it worked


I worked! Thanks a lot, Oliveiros.

I didn't understand which is the aim of the condition
WHERE (((b."date" - a."date") = 1) OR (b."date" - a."date") = 0)

And should I modify the query if the time interval ( in days ) is varing?



Loredana


В списке pgsql-novice по дате отправления:

Предыдущее
От: "Loredana Curugiu"
Дата:
Сообщение: Re: Fw: Count rows group by time intervals
Следующее
От: "Oliveiros Cristina"
Дата:
Сообщение: Re: Fw: Count rows group by time intervals