SELECT DATEPART()的行 [英] SELECT row by DATEPART()

查看:68
本文介绍了SELECT DATEPART()的行的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我需要从记录为一个月的数据库中获取行.我尝试了这个SELECT:

I need to get rows from the database where the records are of one month. I tried this SELECT:

$result = mysql_query("SELECT * FROM my_table WHERE DATEPART('month', date_column)=11");

在数据库中有很多行,在11个月中有一个日期,但是我没有得到任何结果. 谁能帮我?谢谢!

In database is a lot of rows that have a date in the 11. month, but i do not get any results. Can anyone help me? Thank!

推荐答案

没有 DATEPART 函数.使用 MONTH(date_column) 或而是 EXTRACT(MONTH FROM date_column) .

There is no DATEPART function in MySQL. Use MONTH(date_column) or EXTRACT(MONTH FROM date_column) instead.

这篇关于SELECT DATEPART()的行的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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