select语句给出了正确的结果,但在create table中使用时给出了相同的错误:错误1411(hy000):函数str \u to \u date的datetime值“”不正确。有什么建议吗?
SELECT extraction_id,invoice_date from extracted_fields
WHERE nullif(str_to_date(invoice_date,'%Y-%m-%d'),FROM_DAYS(0)) >= '2017-04-01'
AND nullif(str_to_date(invoice_date,'%Y-%m-%d'),FROM_DAYS(0)) <= '2018-03-31';
| 210147 | 2017-09-27 |
| 210150 | 2017-10-05 |
| 210208 | 2018-03-22 |
| 210211 | 2018-03-26 |
| 210214 | 2018-03-27 |
| 210453 | 2018-02-09 |
| 210463 | 2017-11-30 |
| 210594 | 2018-03-28 |
| 210663 | 2017-12-05 |
+---------------+--------------+
51968 rows in set, 24328 warnings (0.21 sec)
mysql> CREATE TABLE `tmp_2017-18_list_subu`
-> AS
-> SELECT extraction_id,invoice_date from extracted_fields
-> WHERE nullif(str_to_date(invoice_date,'%Y-%m-%d'),FROM_DAYS(0)) >= '2017-04-01'
-> AND nullif(str_to_date(invoice_date,'%Y-%m-%d'),FROM_DAYS(0)) <= '2018-03-31';
ERROR 1411 (HY000): Incorrect datetime value: '' for function str_to_date
mysql> SELECT @@VERSION;
+-------------------------+
| @@VERSION |
+-------------------------+
| 5.7.24-0ubuntu0.16.04.1 |
+-------------------------+
1 row in set (0.00 sec)
谢谢您,
苏布
暂无答案!
目前还没有任何答案,快来回答吧!