对本机函数 'DATEDIFF' 的调用中的参数计数不正确 [英] Incorrect parameter count in the call to native function 'DATEDIFF'

查看:39
本文介绍了对本机函数 'DATEDIFF' 的调用中的参数计数不正确的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我从这一行得到错误

SELECT table.field
FROM table
WHERE table.month = 'october'
AND DATEDIFF(day, table.start_date, table.end_date) < 30

我的专栏中的日期格式为 m-d-yy

The dates in my column are in the format m-d-yy

我需要将其转换为其他格式吗?如果有怎么办?

Do I need to convert this to a different format? If so how?

使用 MariaDB

推荐答案

根据 MariaDB 的文档 DATEDIFF 只接受 两个 参数:

According to the documentation for MariaDB DATEDIFF only takes two arguments:

语法

DATEDIFF(expr1,expr2)

说明

DATEDIFF() 返回 (expr1 – expr2)表示为从一个日期到另一个日期的天数.expr1expr2 是日期或日期和时间表达式.只有日期部分这些值用于计算.

DATEDIFF() returns (expr1 – expr2) expressed as a value in days from one date to the other. expr1 and expr2 are date or date-and-time expressions. Only the date parts of the values are used in the calculation.

这篇关于对本机函数 'DATEDIFF' 的调用中的参数计数不正确的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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