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

How to query the month in a date in mysql

王林
Release: 2020-09-30 11:06:35
Original
3825 people have browsed it

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;
Copy after login

Get the year

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

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!

Related labels:
source:php.cn
Statement of this Website
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
Popular Tutorials
More>
Latest Downloads
More>
Web Effects
Website Source Code
Website Materials
Front End Template