Operation Details
Description: Returns the number of task assignments for all the positions of a user per taskID.
Sterotype: ns
SQL
SELECT
  COUNT(*)
INTO
  :numberOfRecords 
FROM
  TaskAssignment ta 
WHERE ta.assigneeType = :assigneeType 
  AND ta.taskID = :taskID 
  AND ta.relatedID IN 
  ( 
  SELECT
    DISTINCT p.positionID 
  FROM
    Users u ,
    PositionHolderLink ph ,
    Position p 
  WHERE u.userName = :userName 
    AND u.userName = ph.userName 
    AND ph.positionID = p.positionID 
    AND ph.recordStatus = :recordStatus 
    AND :currentDate >= ph.fromDate 
    AND 
    (
      :currentDate <= ph.toDate 
      OR ph.toDate IS NULL 
    ) 
  )