Require correct of query .. I am new in SQL Server

Occasional Contributor


I need 6 month avg for each Ticket id . i have written below query but did get correct Average output. Please can you make it correct . 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,
 pt.date_created  as Date_months, count( AS TicketCount,
(count( AS TicketAV
from organization o
join project_task pt on pt.org_id =
where pt.date_created >= '2021-01-01'

4 Replies

but did get correct Average output.

@Trilok_Bohra , and in which way is the result not correct?



What for result do you expect here; some count divided by 6?


Please post table design as DDL, some sample data as DML statement and the expected result.


i can't share the data. its on my office system. we don't have access right . so i can share you the output file in xls format. i am looking the output with same manner

It has been done now .thanks
Two way street here, Trilock... please post the query that worked for you so that others may learn