|
|
|||||||||
|
|||||||||
| |||||||||
|
|
|
| |||||||||
![]() |
|
|
«
Previous Thread
|
Next Thread
»
|
Thread Tools | Search this Thread | Rate Thread | Display Modes |
|
#1
|
|||
|
|||
|
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
__________________
For everything Oracle - www.oraclehome.co.uk |
|
#2
|
|||
|
|||
|
i can give you a syntax if you like:
[code]select name, month, year, sum(salevalue), rank() over (order by sum(saleValue) desc) as salesrank from sale, salesrep, time where sale.srid = salesrep.srid and sale.code = time.code group by name, month, year; |
![]() |
| Viewing: Dev Shed Forums > Databases > Oracle Development > SQL Question - maybe lead and rank |
| Thread Tools | Search this Thread |
| Display Modes | Rate This Thread |
|
|
|
|