select att.name, year(atn.dts) atnYear, count(*) howmany --, min(atn.dts) mindts, max(atn.DTS) maxdts from AnnotationTypes att join Annotations atn on atn.TypeID = att.TypeID group by att.Name, year(atn.DTS)