1. Error description
1010 warnings查询:SELECT t.`name`, DATE_FORMAT(str_to_date(‘2015‘‘%Y‘03...1582infunction‘str_to_date‘执行耗时 0 sec传送时间 0 sec总耗时 0 sec
2. Cause of Error
SELECTT.' name ', Date_format (Str_to_date (' + '),'%Y ') asStatisdate, ROUND (Ifnull (SUM(T.' Amount '),0),3) asAmount fromT_stu_info TWHERE 1=1 andDate_format (T.statisdate,'%Y ') =' + ' UNION All SELECTT.' name ', Date_format (Str_to_date (' the '),'%Y ') asStatisdate, ROUND (Ifnull (SUM(T.' Amount '),0),3) asAmount fromT_stu_info TWHERE 1=1 andDate_format (T.statisdate,'%Y ') =' the '
The format of MySQL built-in function str_to_date is: str_to_date (string, date format);
In this query SQL is str_to_date (string), resulting in an error
3. Workaround
modifying query SQL statements
SELECTT.' name ', Date_format (Str_to_date (' + ','%Y '),'%Y ') asStatisdate, ROUND (Ifnull (SUM(T.' Amount '),0),3) asAmount fromT_stu_info TWHERE 1=1 andDate_format (T.statisdate,'%Y ') =' + ' UNION All SELECTT.' name ', Date_format (Str_to_date (' the ','%Y '),'%Y ') asStatisdate, ROUND (Ifnull (SUM(T.' Amount '),0),3) asAmount fromT_stu_info TWHERE 1=1 andDate_format (T.statisdate,'%Y ') =' the '
Copyright NOTICE: This article for Bo Master original article, without Bo Master permission not reproduced.
Error code: 1582 incorrect parameter count in the call to native function ' str_to_date '