GROUP BY in some specific way
Posted: Tue Oct 23, 2012 8:54 pm
Hi,
I have a peculiar requirement. apparently this is a smaller part of a bigger query. But rest of the things I am able to manage, except this small part.
I have a regular table whose data is something like this:
My Output should be:
Basically I want to get the first start date and last end date for consecutive components having same managers. else it should be as in the table.
Any help would be greatly appreciated..
thanks a lot.
chig.
I have a peculiar requirement. apparently this is a smaller part of a bigger query. But rest of the things I am able to manage, except this small part.
I have a regular table whose data is something like this:
Component_number start_date end_date manager
1 2000-01-01 2005-03-13 M1
2 2005-03-14 2006-02-28 M1
3 2006-03-01 2006-03-10 M2
4 2006-03-11 9999-12-31 M1
1 2000-01-01 2005-03-13 M1
2 2005-03-14 2006-02-28 M1
3 2006-03-01 2006-03-10 M2
4 2006-03-11 9999-12-31 M1
My Output should be:
start_date end_date Manager
2000-01-01 2006-02-28 M1
2006-03-01 2006-03-10 M2
2006-03-11 9999-12-31 M1
2000-01-01 2006-02-28 M1
2006-03-01 2006-03-10 M2
2006-03-11 9999-12-31 M1
Basically I want to get the first start date and last end date for consecutive components having same managers. else it should be as in the table.
Any help would be greatly appreciated..
thanks a lot.
chig.