date_stamp实例格式为:2020-05-20
使用date_format将格式转化为20200520
select date_format(date_stamp,'%Y%m%d') as d
from table_name
在数据库使用的时候能查得到数据,但是用python运行就报了unsupported format character ‘Y’ (0x59) at index 167错误查询之后发现,是因为%Y与python的参数%s冲突
解决的办法就是把%Y%m%d 改成 %%Y%%m%%d