Data across multiple years.
<p>I need to show the following results in multiple years at once. So, rather than running this report for 2014, then 2015, and finally 2016 I would like to run it one time for all three years (@startDate &amp; @endDate). Not certain if a rollup would work? Or grouping sets? The user would like to compare the data across multiple years. Thanks! </p>

<pre><code>select ct.srv_ct_label as service, count (distinct cln.cln_urn) as total
 from cw_domain dmn
inner join cw_service srv on srv.srv_dmn_fk=dmn.dmn_pk
inner join cw_client cln on cln.cln_pk=srv.srv_cln_fk
inner join cw_subservice sbs on sbs.sbs_pk=srv.srv_sbs_fk
inner join cw_service_category ct on ct.srv_ct_rpk=sbs.sbs_srv_ct_rfk
where
srv_ct_rpk in (
'001',
'002',
'004',
'025',
'040',
'003',
'026',
'017',
'016',
'034',
'041',
'042',
'018',
'029'
)
and srv.srv_date &gt;=@startDate and srv.srv_date &lt;=endDate
group by ct.srv_ct_label, srv_ct_rpk, srv.srv_date
order by
case srv_ct_rpk
when '001' then 1
when'040' then 2
when '003' then 3
when '025' then 4
when '002' then 5
when '004' then 6
when '041' then 7
when '026' then 8
when '017' then 9
when '034' then 10
when '042' then 11
when '018' then 12
when '029' then 13
end
</code></pre>