Q&A for administrators and users of the CiviCRM Constituent Relationship Management software
select format(min(v.creationdate),'yyyy-MM-dd') as [First Registered], case when vt.name is not null then vt.name else v.votetypeid end as [Vote Type] from votes as v left join votetypes as vt on vt.id = v.votetypeid where v.votetypeid in (19,20,21,29,30,31,32,33) group by v.votetypeid, vt.id, vt.name order by min(v.creationdate) asc