make sure you do this tweak if you need decimal result
SELECT avg(no_count*1.0)
FROM
(select count(d.pod_number) AS no_count, year(h.adddate) AS Yr, month(h.adddate) AS Mth
from cad_pord_hdrs h, cad_pord_dtls d
where h.cmp_code = d.cmp_code
and h.doc_code = d.doc_code
and h.por_number = d.por_number
group by year(h.adddate), month(h.adddate)
) as t1 -- or whatever you want to call it
see reason here
http://beyondrelational.com/modules/2/blogs/70/posts/10825/beware-of-implicit-conversions.aspx
------------------------------------------------------------------------------------------------------
SQL Server MVP
http://visakhm.blogspot.com/