Dates - Grouping Start and End dates of sequential assignments.

M

MSC

Hi,

I'm trying to group assignments for people by the dates that assignment
started and ended - but only sequential assignments to be grouped.
eg:
Table: U
Fields:
ID - Long Int
Name - Text
Role - Text
assgn_start - Date
assgn_end - Date
Allocation - Long Int
Program - Text

Example:
L ID Name Role assgn_start assgn_end Allocation Program
1 994800 Owens, T BSA 01/01/2009 05/04/2009 100 Red
2 994800 Owens, T BSA 06/04/2009 01/05/2009 50 RM
3 994800 Owens, T BSA 06/04/2009 01/05/2009 50 Red
4 994800 Owens, T BSA 02/05/2009 05/06/2009 100 Red
5 994800 Owens, T BSA 06/06/2009 21/06/2009 100 Red
6 994800 Owens, T BSA 22/06/2009 31/07/2009 90 SII
7 994800 Owens, T BSA 22/06/2009 31/07/2009 10 Red

If I use the Min/Max or First/Last functions within a select query it groups
assignments 1, 4 & 5 starting 01-01-09 and end 21-06-09, as everything else
is the same.
BUT thats not a true reflection of the assignments, the only ones that
should be grouped are 4 & 5 as they follow on from each other.

So, I need help in grouping like assignments that follow on from each other.

I've posted this question before, but tried to be clearer this time - any
help appreciated.

Cheers
MSC
 

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