We help IT Professionals succeed at work.
Get Started

How to get date ranges of islands of records? 2

88 Views
Last Modified: 2016-02-29
Hello,

I have following data:
ID  Date  Category
1  1/1/2000  1
2  1/2/2000  1
3  1/4/2000  1
4  1/6/2000  2
5  1/8/2000  2
6  1/10/2000 1
7  1/12/2000 1

the result should be:
Category  DateStart  DateEnd
1                1/1/2000   1/4/2000
2                1/5/2000   1/9/2000    
1                1/10/2000   1/12/2000

Briefly, Category 2 (if any records exist with this Category) must fit into interval, not occupied by Category 1

Please help
Thank you
Comment
Watch Question
Database Engineer
CERTIFIED EXPERT
Top Expert 2005
Commented:
This problem has been solved!
Unlock 1 Answer and 6 Comments.
See Answer
Why Experts Exchange?

Experts Exchange always has the answer, or at the least points me in the correct direction! It is like having another employee that is extremely experienced.

Jim Murphy
Programmer at Smart IT Solutions

When asked, what has been your best career decision?

Deciding to stick with EE.

Mohamed Asif
Technical Department Head

Being involved with EE helped me to grow personally and professionally.

Carl Webster
CTP, Sr Infrastructure Consultant
Ask ANY Question

Connect with Certified Experts to gain insight and support on specific technology challenges including:

  • Troubleshooting
  • Research
  • Professional Opinions
Did You Know?

We've partnered with two important charities to provide clean water and computer science education to those who need it most. READ MORE