Forum Discussion
Trilok_Bohra
Jan 04, 2022Copper Contributor
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'
- olafhelperBronze Contributor
EXTRACT(month from pt.date_created )Trilok_Bohra , that's PL/SQL syntax for Oracle databases, this is a forum for Microsoft SQL Server / Transact-SQL.
Better post at Welcome | Oracle Communities