首页 诗词 字典 板报 句子 名言 友答 励志 学校 网站地图
当前位置: 首页 > 教程频道 > 数据库 > SQL Server >

MSSQL查找当月或本年数据

2012-09-09 
MSSQL查寻当月或本年数据select * from $tb$ where datediff(mm,$col$,getdate())0? --当月select * from

MSSQL查寻当月或本年数据

select * from $tb$ where datediff(mm,$col$,getdate())=0? --当月select * from $tb$ where datediff(year,$col$,getdate())=0 --当年

?其中,$tb$为表名,$col$为日期列。

热点排行