for drupalmotion.com
Q&A for Ubuntu users and developers
select voteType, count(id),[Month] from ( select vt.name as voteType, v.id, CAST( cast(DATEPART(YYYY, v.CreationDate) as varchar) + '-' + cast(DATEPART(MM, CreationDate) as varchar) + '-01' as datetime) [Month] from Votes as v join VoteTypes as vt on vt.id = v.VoteTypeId where vt.name in ('AcceptedByOriginator','UpMod') ) as a group by voteType, [Month] order by [Month] asc, voteType asc