mysq 时间查询的所有语句

来源:百度知道 编辑:UC知道 时间:2024/05/01 23:59:28
如果值查询某月的内容呢
如果是通用数据库怎么写显示某月的语句啊

如果只是某月的内容

select * from [表名]
where datepart(month,[日期字段])=9

这是查询9月的数据,不管是哪年的.如果要查询某年某月的数据:
select * from [表名]
where datepart(year,[日期字段])=2008
and datepart(month,[日期字段])=9
这是查2008年9月的数据.