当我像这样创建sql查询时:
param = (date, )
query = SELECT date_added from deploy_requests WHERE date_added LIKE '%s %'
query.execute(query, param)
我得到语法错误
但如果我用不推荐的方法
query = SELECT date_added from deploy_requests WHERE date_added LIKE '{} %'.format(date)
当我像这样创建sql查询时:
param = (date, )
query = SELECT date_added from deploy_requests WHERE date_added LIKE '%s %'
query.execute(query, param)
我得到语法错误
但如果我用不推荐的方法
query = SELECT date_added from deploy_requests WHERE date_added LIKE '{} %'.format(date)
1条答案
按热度按时间qq24tv8q1#
我想,我就是这样做的。