Re: [SQL] SQL to Check whether AN HOUR PERIOD is between start and end timestamps

2009-04-02 Thread James Kitambara
Dear Srikanth, You can solve your problem by doing this THE SQL IS AS FOLLOWS   ASSUME TIME INTERVAL 2008-12-07 07:59:59 TO 2008-12-07 08:58:59 AND THE TABLE NAME time_interval  COUNT (*) FROM       (select customer_id, log_session_id, start_ts, end_ts , end_ts-start_ts as Interval from

Re: [SQL] SQL to Check whether AN HOUR PERIOD is between start and end timestamps

2009-04-02 Thread Alvaro Herrera
James Kitambara wrote: Dear Srikanth, You can solve your problem by doing this THE SQL IS AS FOLLOWS   ASSUME TIME INTERVAL 2008-12-07 07:59:59 TO 2008-12-07 08:58:59 AND THE TABLE NAME time_interval  COUNT (*) FROM       (select customer_id, log_session_id, start_ts, end_ts ,

Re: [SQL] SQL to Check whether AN HOUR PERIOD is between start and end timestamps

2009-03-18 Thread Srikanth
That did the job. Thanks. Am new to SQL, does not even know that there exists an Operator called OVERLAPS. Thanks Richard ../rssrik --- On Tue, 17/3/09, Richard Huxton d...@archonet.com wrote: From: Richard Huxton d...@archonet.com Subject: Re: [SQL] SQL to Check whether AN HOUR PERIOD is

[SQL] SQL to Check whether AN HOUR PERIOD is between start and end timestamps

2009-03-17 Thread Srikanth
Dear all, I have a table that records User Login Sessions with two timestamp fields. Basically Start of Session and End of a Session (start_ts and end_ts). Each row in the table identifies a session which a customer has used.  Data from the table (session): -  

Re: [SQL] SQL to Check whether AN HOUR PERIOD is between start and end timestamps

2009-03-17 Thread Richard Huxton
Srikanth wrote: Dear all, I have a table that records User Login Sessions with two timestamp fields. Basically Start of Session and End of a Session (start_ts and end_ts). Each row in the table identifies a session which a customer has used. Data from the table (session):