I found the answer i can write query this way
select------where(months=@months and years=@years) or (months=@months-1 and years=@years-1) where @months and @years are the parameters user is entering, and it is working in any case
thanks for ur consideration