Forum Discussion

Trilok_Bohra's avatar
Trilok_Bohra
Copper Contributor
Jan 04, 2022

Requeir 6 month AVG for each id

 

Hi

I need 6 month avg for each Ticket id . i have written below query but did get correct output. Please can me correction . i think i need to use subquery on it but i dont know how . Please suggest

 

select o.id,o.name as Org_Name ,pt.id as Ticket_ID, pt.date_created,
EXTRACT(month from pt.date_created ) as months, count(pt.id) AS TicketCount,
(count(pt.id))/6 AS TicketAV
from organization o
join project_task pt on pt.org_id = o.id
left join account a on a.id = pt.acct_creator
left join organization o2 on o2.id = a.organization_id
join privilege p on p.id = pt.app_id
where pt.date_created >= '2021-01-01'

Resources