Database SQL Operation: InvestigationApprovalCheck.readForOrgUnit
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.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.recordStatus = :recordStatus
|