Requeir 6 month AVG for each id

Occasional Contributor



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, as Org_Name , as Ticket_ID, pt.date_created,
EXTRACT(month from pt.date_created ) as months, count( AS TicketCount,
(count( AS TicketAV
from organization o
join project_task pt on pt.org_id =
left join account a on = pt.acct_creator
left join organization o2 on = a.organization_id
join privilege p on = pt.app_id
where pt.date_created >= '2021-01-01'

1 Reply


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