I would like to concatenate the following data in sql code.
R12 Months Year Month
I was thinking something like
case when [R12] = 'R12PY' then concat(min(yearmonth)) + '-' + concat(max(yearmonth))
when [r12] = 'R12CY' then concat(min(yearmonth)) + '-' + concat(max(yearmonth))
The goal is to have it like 201912 - 202004 for R12PY and 202012 - 202104 for the R12CY and I could just write it like that but the data changes every month so I would be manually writing something and want this automated