[英]Incorrect parameter count in the call to native function 'DATE_FORMAT'
Not sure how to fix this error不知道如何解决这个错误
Incorrect parameter count in the call to native function 'DATE_FORMAT'
调用本机函数“DATE_FORMAT”时的参数计数不正确
Code:代码:
SELECT
id, user_id, client_name, client_phone,
(SELECT name
FROM users_permissions
WHERE users_permissions.user_id = contracts.assistant_id) AS Consultant
FROM
contracts
WHERE
contracts_statuses IN (1, 2)
AND transaction_type = 'rent'
AND DATE_FORMAT('%Y-%m') > '2017-08'
您需要将日期列添加到date_format
,例如DATE_FORMAT(contracts.date, '%Y-%m')
The DATE_FORMAT() function formats a date as specified by a format mask. DATE_FORMAT() 函数按照格式掩码指定的格式格式化日期。
syntax : DATE_FORMAT(date, format_mask)
语法:
DATE_FORMAT(date, format_mask)
so in this case you specifiy the date which needs to be masked with the required format.所以在这种情况下,您指定需要用所需格式屏蔽的日期。 ie :'%Y-%m'
即:'%Y-%m'
声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.