第1行中列的MySQL错误代码1292错误日期值1999

时间:2021-03-09 01:59:15

This question has been addressed before many times, but the answers are about the wrong format of the date. The format of the date I have used is correct: YYYY-MM-DD according to the manual.

这个问题之前已经提过很多次了,但是答案是错误的。我所使用的日期格式是正确的:yyyyy - mm - dd按手册要求。

So what could be the possible cause of this error?

那么这个错误的可能原因是什么呢?

I am using MySQL 5.5 if that matters.

我用的是MySQL 5.5。

EDIT:- The query I am trying to execute:-

编辑:-我正在执行的查询:-

insert into table2 (pk_id)
select pk_id from table1
where pk_date in  (2014-01-04, 2014-02-05, 2014-03-23, 2014-05-01, 2014-07-28) 
order by pk_id asc;

1 个解决方案

#1


4  

The issue is on the IN condition for dates, date is string and it needs to be quoted with single quote as

这个问题是关于日期的,日期是字符串,它需要引用单引号。

where pk_date in ('2014-01-04', '2014-02-05', '2014-03-23', '2014-05-01', '2014-07-28')

#1


4  

The issue is on the IN condition for dates, date is string and it needs to be quoted with single quote as

这个问题是关于日期的,日期是字符串,它需要引用单引号。

where pk_date in ('2014-01-04', '2014-02-05', '2014-03-23', '2014-05-01', '2014-07-28')