当涉及到使用这个函数查询的时候 如何select 不动态传递参数 如何新添加参数就会报以下的错误
ValueError: unsupported format character 'Y' (0x59) at index 47
select date_format(dd,'%Y-%m-%d') a_dd from user ;这样没有问题
select date_format(dd,'%Y-%m-%d') a_dd from user where userid in %s;
ord_sta = (12,33)
cursor.execute(sql, params) 就出错误了 不晓得大家怎么解决
Please use '%%Y-%%m-%%d'. When sql has %s, it will be pre-compiled. Other characters with % will be compiled, and %Y is not any kind. .
What do you use to operate the database? ? sqlalchemy or mysql.connector??
If it is sqlalchemy, use the strftime('%Y-%m-%d') method to get the time represented by a string