Aren't you already doing that via the "and datepart..." in your where clause? It might be more efficient to do that like shwon below:SELECT afe_number , rpt_cntr , account , aquisition , SUM(line_amount) , gl_date , gl_line_descriptionFROM dmrt_nfx.xxnf_gl_detail_tableWHERE rc_uid IN ( 288070, 288071, 288072 ) AND gl_date >= DATEADD(yy,DATEDIFF(yy,0,GETDATE())-2,0) AND gl_date < DATEADD(yy,DATEDIFF(yy,0,GETDATE())+1,0)GROUP BY afe_number , rpt_cntr , account , aquisition , gl_date , gl_line_description