Database SQL Operation: Position.countLeadPositionForPositionByUser
Description: | Returns the count of lead position for position for a user. |
Sterotype: | ns |
SELECT
count(*)
INTO
:numberOfRecords
FROM
position p,
OrgUnitPositionLink oup,
PositionHolderLink phl
WHERE oup.organisationUnitID IN
(
SELECT
oup.organisationUnitID
FROM
OrgUnitPositionLink oup
WHERE oup.positionID = :positionID
AND oup.recordStatus = :recordStatus
)
AND p.positionID = oup.positionID
AND oup.positionID = phl.positionID
AND p.leadPositionInd ='1'
AND phl.userName = :userName
AND phl.recordStatus = :recordStatus
AND :currentDate >= phl.fromDate
AND
(
:currentDate <= phl.toDate
OR phl.toDate IS NULL
)
|