MySQL按MONTH选择一列 [英] mySQL select a column by MONTH

查看:100
本文介绍了MySQL按MONTH选择一列的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我的表格中有一列以以下格式存储日期:

I have a column in my table that stores a date in the format:

2011-08-06 11:00:00

2011-08-06 11:00:00

有没有一种方法可以编写一条基于该列的MONTH选择行条目的sql语句?

Is there a way to write an sql statement that selects row entries based on this column's MONTH?

例如,如何在此表中的COLUMN_NAME = "August"中选择所有条目?

Say for example, how would I select all entries in this table where COLUMN_NAME = "August"?

推荐答案

您可以使用如果您绝对需要使用它作为名称,则可以使用 MONTHNAME()的用法相同.但是返回的名称取决于语言环境.

If you absolutely need it as a name, you can use MONTHNAME() the same way. But the returned name depends on the locale.

这篇关于MySQL按MONTH选择一列的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆