У меня есть запрос. SELECT DISTINCT
  users.name,
  orders_task.id,
  orders_task.data,
  orders_task.name_of_order, 
  topics.name
FROM public.orders_task
JOIN public.users_orders
    ON orders_task.id = users_orders.orders_task_id
JOIN public.users
  ON users_orders.users_id = users.id
JOIN public.tasks_order 
  ON tasks_order.orders_task_id = users_orders.orders_task_id 
JOIN public.tasks 
  ON tasks.id = tasks_order.tasks_id
JOIN public.tasks_topics 
  ON tasks.id = tasks_topics.task_id
JOIN public.topics 
  ON tasks_topics.topics_id = topics.id  
JOIN 
    (SELECT *
    FROM public.users_orders
    WHERE users_orders.users_id = 6 ) AS query_from_users_orders
    ON orders_task.id = query_from_users_orders.orders_task_id
WHERE 
  users_orders.is_homework. Я хочу добавить количество tasks в orders. Как это сделать?