Hello,
I have come to seek some help about an oracle querry thats driving me crazy... I managed to return the results i was supposed to return, but I feel like posting the querry here would result in an front page feature for myself ;)
Anyway.. here is the setup and the requirement (simplified):
Tables:
1. Requirements (ID,TargetID,TargetType)
2. Deadline (ID,Req_ID,Deadline_Date, Status_ID)
3. Status (ID, Name) (Just a lookup)
4. Target (ID, Status_ID) (Might be "missing" from the requirement)
- Each Requirement has N Deadlines
- The Status_ID of the Target tells us which is the current Deadline_Date
- If the Target is missing, return the the 1st Deadline date (min)
Question:
Return me the next Deadline Date for all Requirements
if the Target is missing, return the minimum deadline date for that requirement
If the target exists, return the requirement date that is bigger then the current status of the deadline
Can anyone give me some help regarding the analytic function of oracle for this - The solution i am currently
looking at uses a nasty subquerry with case statements to destinguish between the cases?
Thanks a lot in advance
rdrunner