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

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

问题描述

我从这一行中得到了错误

I get the error from this line

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天全站免登陆