目标是想通过字典工具输入时间范围获得sql表中对应的行
date = {'b':'2019-01-01','e':'2019-12-31'} sql1 = """select id,t_player_order.player_id,order_id,money,DATE_FORMAT(t_player_order.handle_dt,'%Y-%m'),DATE_FORMAT(t_player.create_dt,'%Y-%m') from t_player_order left join t_player on t_player_order.player_id = t_player.player_id WHERE handle_dt between '{b}' and '{e}' """.format(b=date.get('b'),e=date.get('e')) # wrong!!! # sql1 = """select id,t_player_order.player_id,order_id,money,DATE_FORMAT(t_player_order.handle_dt,'%Y-%m'),DATE_FORMAT(t_player.create_dt,'%Y-%m') from t_player_order left join t_player # on t_player_order.player_id = t_player.player_id WHERE handle_dt between 'b' and 'e' """
cursor1.execute(sql1)
原创文章,作者:ItWorker,如若转载,请注明出处:https://blog.ytso.com/tech/database/277529.html