Home  >  Article  >  Database  >  How to query the month in a date in mysql

How to query the month in a date in mysql

王林
王林Original
2020-09-30 11:06:353745browse

Mysql method to query the month in the date: execute the [SELECT * FROM BLOG WHERE MONTH(CREATETIME)=7;] statement.

How to query the month in a date in mysql

Get the month

(Recommended tutorial: mysql tutorial)

SELECT * FROM BLOG WHERE MONTH(CREATETIME)=7;

Get the year

SELECT * FROM BLOG WHERE YEAR(CREATETIME)=7;

Related recommendations: php training

The above is the detailed content of How to query the month in a date in mysql. For more information, please follow other related articles on the PHP Chinese website!

Statement:
The content of this article is voluntarily contributed by netizens, and the copyright belongs to the original author. This site does not assume corresponding legal responsibility. If you find any content suspected of plagiarism or infringement, please contact admin@php.cn