mysql 语句
mysql 语句 有个字段叫 wr_datetime 为时间格式 默认格式是 Y-m-d H:i:s 我用什么语句能直接筛选出wr_datetime 中所有m为10的数据
mysql 语句 有个字段叫 wr_datetime 为时间格式 默认格式是 Y-m-d H:i:s 我用什么语句能直接筛选出wr_datetime 中所有m为10的数据
答案:select * from 表 where month(wr_datetime) ='10'
其他:datename(month,getdate())返回月份
select * from 表 where datename(month,wr_datetime)=10 楼主可以使用mysql 的时间函数MONTH
例如:select month("2011-11-08 10:00:00"); 执行结构为月份值“11”;
针对楼主的筛选问题sql 如下:
select * from表 t where month(wr_datetime )=10
执行应该可以进行筛选,有不明白的尽可提问。