Linker IT Software
menubar-top-links menubar-top-rechts
Home Help Search Login
Welcome, Guest. Please Login.
SQL*XL: Database to Excel bridge litLIB: Excel power functions pack ExcelLock: Locking and securing your valuable Excel spreadsheets encOffice: Protect your Excel file easy and safe encOffice: Protect your Excel file easy and safe
Pages: 1
Determine date overlap (Read 5807 times)
Gerrit-Jan Linker
YaBB Administrator

Posts: 75
Determine date overlap
19.09.06 at 08:42:48
Determine date overlap.
Suppose you have a table with a start_date and end_date. If you have the requirement to determine whether there is overlap in the periods defined by the start_data and end_dates you can use the following approach.
With the following query overlap can be determined. If rows are returned, periods are in overlap.

select  *
from    my_table a
,       my_table b
where   b.start_date < a.end_date
and     b.end_date   > a.start_date
and not b.rowid = a.rowid

In this query we make a cartesian product of the rows in the table. With the condition "not b.rowid = a.rowid" we ensure that a row is compared with itself. What remains is a combination of all the other possible rows.
Back to top
« Last Edit: 19.09.06 at 08:43:08 by Gerrit-Jan Linker »  

Gerrit-Jan Linker
Linker IT Software
Email WWW Gerrit-Jan Linker   IP Logged
Pages: 1