Re: [SQL] Count dates distinct within an interval

2003-07-15 Thread Stuart
Dmitry Tkach wrote: Hi, everybody! I was trying to formulate a sql query, that I now think is impossible :-( I just thought, I'd run it by you before I give up - perhaps, you guys would have some ideas... Suppose, I have a table like this create table test ( stuff int, stamp timestamp ); No

Re: [SQL] Count dates distinct within an interval

2003-07-15 Thread greg
-BEGIN PGP SIGNED MESSAGE- Hash: SHA1 > Also, I could certainly write a simple function, that would get all the > entries in order, and scan through them, counting according to my rules... > But I was hoping to find some way to do this in plain sql though... In this example, you are be

Re: [SQL] Count dates distinct within an interval

2003-07-15 Thread Dmitry Tkach
You need to elaborate on your logic some more, and state exactly what you would want in the A,B,C case above. Does B get lumped with A or with C? It is within 24 hours of both, after all. Does C not get lumped in with B simply because B has already been lumped in with A? Yes. The first (earli

Re: [SQL] Count dates distinct within an interval

2003-07-15 Thread greg
-BEGIN PGP SIGNED MESSAGE- Hash: SHA1 > Now, I want to count the occurences of each value of stuff in the table, > but so that entries within 24 hours from each other count as one... >... > A = 2001 - 01- 01 20:20:00 > B = 2001 - 01 - 02 20:19:00 > C = 2001 - 01 - 02 20:21:00 > Should

[SQL] Count dates distinct within an interval

2003-07-15 Thread Dmitry Tkach
Hi, everybody! I was trying to formulate a sql query, that I now think is impossible :-( I just thought, I'd run it by you before I give up - perhaps, you guys would have some ideas... Suppose, I have a table like this create table test ( stuff int, stamp timestamp ); Now, I want to count t