Database SQL Operation: ProductDeliveryCertDiary.searchCertificationGracePeriod
Description: | Method to search for all records that are the most recent entry for a case, and retrieve their details, the status of the associated cases and the certGracePeriod of the associated products |
Sterotype: | nsmulti |
SELECT
ProductDeliveryCertDiary.caseID,
ProductDeliveryCertDiary.periodToDate,
Product.certGracePeriod,
CaseHeader.statusCode
INTO
:caseID,
:periodToDate,
:certGracePeriod,
:statusCode
FROM
ProductDeliveryCertDiary,
ProductDelivery,
CaseHeader,
Product
WHERE ProductDeliveryCertDiary.caseID = CaseHeader.caseID
AND CaseHeader.caseID = ProductDelivery.caseID
AND ProductDelivery.productID = Product.productID
AND ProductDeliveryCertDiary.periodToDate = (
SELECT
MAX(periodToDate)
FROM
ProductDeliveryCertDiary diary2
WHERE diary2.caseID = ProductDeliveryCertDiary.caseID
)
AND CaseHeader.statusCode <> :cancelledStatus
|