SELECT
PlannedSubGoal.plannedSubGoalID,
SubGoal.name,
PlannedSubGoal.status,
PlannedSubGoal.sensitivityCode,
PlannedItem.plannedItemID,
PlannedItem.name,
PlannedItem.status,
PlannedItem.sensitivityCode,
PlannedItem.estimatedCost,
PlannedItem.actualCost
INTO
:plannedSubGoalID,
:subGoalName,
:plannedSubGoalStatus,
:plannedSubGoalSensitivity,
:plannedItemID,
:plannedItemName,
:plannedItemStatus,
:plannedItemSensitivity,
:plannedItemEstimatedCost,
:plannedItemActualCost
FROM
PlannedGoal,
PlannedSubGoal
LEFT OUTER JOIN
PlannedItem
ON PlannedSubGoal.plannedSubGoalID = PlannedItem.plannedSubGoalID,
SubGoal
WHERE
(
PlannedGoal.caseID = :caseID
)
AND
(
PlannedGoal.plannedGoalID = PlannedSubGoal.plannedGoalID
AND PlannedSubGoal.plannedGroupID IS NULL
)
AND
(
SubGoal.subGoalID = PlannedSubGoal.subGoalID
)
ORDER BY plannedSubGoalID,
plannedItemID
|