为什么这个MySQL查询不起作用?

时间:2022-10-13 09:38:37

What's wrong with these two queries?

这两个查询有什么问题?

SELECT (DATE_ADD('2008-11-31',INTERVAL 365 DAY) + INTERVAL 0 DAY) as occursOn
Result:
(
    [0] => Array
        (
            [occursOn] => 
        )

)

And:

SELECT (DATE_ADD('2008-11-31',INTERVAL 730 DAY) + INTERVAL 0 DAY) as occursOn
Result:
(
    [0] => Array
        (
            [occursOn] => 
        )

)

As you can see, the returned value of occursOn is blank each time.

如您所见,每次返回的happenOn值为空。

These queries are being generated dynamically, therefore the second +INTERVAL 0 DAY is needed and can't be eliminated.

这些查询是动态生成的,因此需要第二个+ INTERVAL 0 DAY,并且无法消除。

2 个解决方案

#1


2008-11-31 not valid date only 30 days in 11th month (November)

2008-11-31无效日期仅在第11个月(11月)的30天

#2


Probably because November has 30 days?

可能是因为11月有30天?

#1


2008-11-31 not valid date only 30 days in 11th month (November)

2008-11-31无效日期仅在第11个月(11月)的30天

#2


Probably because November has 30 days?

可能是因为11月有30天?