Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations gkittelson on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

SQL Question - maybe requiring lead and rank

Status
Not open for further replies.

danielrc15

Programmer
Sep 18, 2003
6
GB
Hi,

I have a problem, I have the following 2 rows:

Start Date End Date Item Used
10/05/04 10/06/04 A
10/05/04 10/10/04 B

As you can see the usage of items A and B overlap, both items A and B are used at the same time for a while, but the usage of A stops after a while and item B is used on it's own.

I need to be able to get them into the following rows:

Start Date End Date Item Used
10/05/04 10/06/04 A
10/05/04 10/06/04 B
11/06/04 10/10/04 B

So I need to know when B was used without A, and then know when B was used on it's own.

I thought of using lead or rank analytic functions, but I have no idea can anybody help?

Thanks

Daniel
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top