Incorrect parameter count in the call to native function 'DATEDIFF'

Alex Borsody picture Alex Borsody · Apr 23, 2014 · Viewed 57.1k times · Source

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

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?

Using MariaDB

Answer

D Stanley picture D Stanley · Apr 23, 2014

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

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.