Tested in builds from PGSQL (14300) or MSSQL (14306)
Since Task template is not stored in Task details, we cannot show count based on task templates. However, we have tried to form a query with task subject considering that, when task templates are used, the subject are not altered.
SELECT taskdet.TITLE AS "Task Title", count(wotask.WORKORDERID) AS "Count of tasks", count(case when std.ispending='0' THEN 1 ELSE NULL END) "Completed",
count(case when std.ispending='1' THEN 1 ELSE NULL END) "Pending" FROM TaskDetails taskdet Inner JOIN WorkOrderToTaskDetails wototaskdet ON taskdet.TASKID=wototaskdet.TASKID LEFT JOIN WorkOrder wotask ON wototaskdet.WORKORDERID=wotask.WORKORDERID LEFT JOIN StatusDefinition std ON taskdet.STATUSID=std.STATUSID WHERE taskdet.TITLE='Check leasing' OR taskdet.TITLE='Check transport' OR taskdet.TITLE='Check power' group by taskdet.TITLE
Note: Task title names are mentioned in the query filter as highlighted, this can be modified as per need.