Month & Year filter in SQL Server -
i have sql server table following columns:
now, have write query return me records "month > may" , "f year > 2016".
i providing both "month" (may) & "f year" (2016) application. there multiple records same month & f year column values.
i tried date part, cast etc. not getting required result.
you can (with month name)
select * tablename datepart(mm, ([month] + ' 01 2016')) > datepart(mm,'may' + ' 01 2016') , fyear > 2016
or (with month number)
select * tablename datepart(mm, ([month] + ' 01 2016')) > 5 , fyear > 2016
Comments
Post a Comment