How can I do this date manipulation

Q

QB

I have a table that has start and end dates for various project.

ProjID Start End
1 2009-01-21 2009-05-12
2 2009-04-13 2009-07-28
3 2009-09-01 2009-11-30

I need to extract a listing that returns the non-overlapping date ranges, ie:
200-01-21 to 2009-07-28, 2009-09-01 to 2009-11-30

How can I do this using SQL?

Thank you

QB
 
K

KARL DEWEY

Your examples do not fit your criteria. End of 2009-05-12 overlaps Start of
2009-04-13.
Maybe you want no-gap sequences. Which is it?
 
J

John W. Vinson

I have a table that has start and end dates for various project.

ProjID Start End
1 2009-01-21 2009-05-12
2 2009-04-13 2009-07-28
3 2009-09-01 2009-11-30

I need to extract a listing that returns the non-overlapping date ranges, ie:
200-01-21 to 2009-07-28, 2009-09-01 to 2009-11-30

How can I do this using SQL?

Not at all easily. You'll need some VBA code to step through a recordset and
construct a text string.
 
Q

QB

You had to burst my bubble! :)

I had so hope it could easily be done using SQL. Thanks for the heads up, I
will start coding.

QB
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Top