c# - Select records from SQL Server if greater than 6 months -
i creating mvc app need send out email records value (dateupdated
) not updated in customer
table.
my customer
table looks this:
id (pk) name address datelastupdated
now have mysql query:
select * users datelastupdated >= now() - interval 6 month
how write in t-sql , perform task in mvc3? please help!
your query should be:
select * users datelastupdated >= dateadd(month, -6, getdate())
additionally, may want strip out time portion left date e.g. 2011-04-12 00:00:00.000
can use this:
select * users datelastupdated >= dateadd(month, -6, cast(floor(cast(getdate() float)) datetime))
Comments
Post a Comment