加入收藏 | 设为首页 | 会员中心 | 我要投稿 李大同 (https://www.lidatong.com.cn/)- 科技、建站、经验、云计算、5G、大数据,站长网!
当前位置: 首页 > 站长学院 > MsSql教程 > 正文

sql – 调用本机函数’DATEDIFF’时参数计数不正确

发布时间:2020-12-12 06:30:34 所属栏目:MsSql教程 来源:网络整理
导读:我从这一行得到了错误 SELECT table.fieldFROM tableWHERE table.month = 'october'AND DATEDIFF(day,table.start_date,table.end_date) 30 我列中的日期格式为m-d-yy 我需要将其转换为其他格式吗?如果是这样的话? 使用MariaDB 解决方法 根据MariaDB DATEDI
我从这一行得到了错误
SELECT table.field
FROM table
WHERE table.month = 'october'
AND DATEDIFF(day,table.start_date,table.end_date) < 30

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

我需要将其转换为其他格式吗?如果是这样的话?

使用MariaDB

解决方法

根据MariaDB DATEDIFF的文档,只有两个参数:

Syntax

DATEDIFF(expr1,expr2)

Description

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.

(编辑:李大同)

【声明】本站内容均来自网络,其相关言论仅代表作者个人观点,不代表本站立场。若无意侵犯到您的权利,请及时与联系站长删除相关内容!

    推荐文章
      热点阅读