Database SQL Operation: InvestigationApprovalCheck.readForOrgUnitAndInvestigation
Description: | |
Sterotype: | ns |
SELECT
DISTINCT(percentage)
INTO
:percentage
FROM
InvestigationApprovalCheck,
PositionHolderLink,
Position,
OrganisationUnit,
OrgUnitPositionLink
WHERE percentage =
(
SELECT
MAX(percentage)
FROM
InvestigationApprovalCheck,
PositionHolderLink,
Position,
OrganisationUnit,
OrgUnitPositionLink
WHERE PositionHolderLink.userName = :userName
AND Position.positionID = PositionHolderLink.positionID
AND
(
(
OrgUnitPositionLink.organisationUnitID = OrganisationUnit.organisationUnitID
)
AND
(
OrgUnitPositionLink.positionID = Position.positionID
)
)
AND InvestigationApprovalCheck.typeCode = :typeCode
AND InvestigationApprovalCheck.investigationConfigID = :investigationConfigID
AND InvestigationApprovalCheck.recordStatus = :recordStatus
)
AND PositionHolderLink.userName = :userName
AND Position.positionID = PositionHolderLink.positionID
AND
(
(
OrgUnitPositionLink.organisationUnitID = OrganisationUnit.organisationUnitID
)
AND
(
OrgUnitPositionLink.positionID = Position.positionID
)
)
AND InvestigationApprovalCheck.typeCode = :typeCode
AND InvestigationApprovalCheck.investigationConfigID = :investigationConfigID
AND InvestigationApprovalCheck.recordStatus = :recordStatus
|