MySQL Forums
Forum List  »  Connector/Python

Re: script crashes on last day of month but works every other day
Posted by: Shawn Green
Date: March 29, 2023 08:07AM

Shorthand responses while I'm waiting for a call to start. Sorry for the brevity.

your statement:
sql = "(select count(*) from meter where date = current_date() + 1)"

1) no () around the statement - you do not need this query to act like a subquery
2) date math in MySQL should include the INTERVAL keyword along with a unit of "intervals" that you are using


try this instead:
sql = "select count(*) from meter where date = current_date() + interval 1 day"

https://dev.mysql.com/doc/refman/8.0/en/expressions.html#temporal-intervals

Options: ReplyQuote


Subject
Written By
Posted
Re: script crashes on last day of month but works every other day
March 29, 2023 08:07AM


Sorry, you can't reply to this topic. It has been closed.

Content reproduced on this site is the property of the respective copyright holders. It is not reviewed in advance by Oracle and does not necessarily represent the opinion of Oracle or any other party.