I tried to do the variable but I can not, ok I explain it better.
I want to get the date of the year 2016 from January to December and from January to June 2017
I can use a direct condition
and T.FECHA_TRAMITE BETWEEN '01 / 01/2016 00:00:00 'AND '06 / 30/2017 23:59:59'
but it is not what I want since for future research I must return to make a new condition.