SELECT ACT_ACT AS activity,
ACT_TRADE AS trade,
ACT_COMPLETED AS completed
FROM r5activities
WHERE  act_event = <param.jobnum> AND act_act > 0 AND COALESCE(ACT_TASK, '') != ''
AND EXISTS (SELECT 1 from R5ACTCHECKLISTS WHERE ACK_EVENT=<param.jobnum> AND COALESCE(act_parent, act_act)=CAST(ACT_ACT as real) AND ack_act=act_act)
