GET 24/7 LIVE HELP NOW

Announcement

Announcement Module
Collapse
No announcement yet.

SQL - free gaps between defined intervals

Page Title Module
Move Remove Collapse
X
Conversation Detail Module
Collapse
  • Filter
  • Time
  • Show
Clear All
new posts

  • SQL - free gaps between defined intervals

    Hello!

    I've got simple table:

    ID INT
    ID_RESOURCE INT
    START_DATE DATETIME
    STOP_DATE DATETIME

    Sample data:

    1, 1, 2013-01-01, 2013-01-05
    2, 1, 2013-01-10, 2013-01-12

    I want to write a query to return every free periods between my min and max dates (in this case 2013-01-06 - 2013-01-09 is free gap for resource ID=1).

    I would be grateful for any help.
Working...
X