To get Month year in select Query

Hello Team,

I need query to get month comma separated as per input variable.

If @Var = 1 Then output will be 'August,July'
IF @Var = 2 Then output will be 'August,July,June'

please help

Sure ... .. is this what you are looking for !!!

declare @output varchar(100) = ''
if @Var = 1 set @output = 'August,July'
if @Var = 2 set @output = 'August,July,June'

if August July June is coming from somewhere else like column
if we have details .. we can help

how is 1 related to August,July and 2 to August,July,June? and are there other @var values or just 1 and 2?