Operation Details
Description: Returns the number of tasks assigned to each work queue where the user is subscribed to.
Sterotype: nsmulti
SQL
SELECT
  DISTINCT wq.workQueueID,
  wq.name,
  COUNT(taskID)
INTO
  :workQueueID,
  :workQueueName,
  :taskCount 
FROM
 WorkQueueSubscription wqs,
  WorkQueue wq 
  
  LEFT  JOIN
  TaskAssignment ta 
  ON wq.workQueueID = ta.relatedID 
  AND ta.assigneeType = :assigneeType 
WHERE 
wq.workQueueID = wqs.workQueueID AND
wqs.userName= :relatedName

GROUP
  BY wq.workQueueID,
  wq.name 
ORDER BY wq.name