diff --git a/queries.py b/queries.py --- a/queries.py +++ b/queries.py @@ -4,6 +4,10 @@ from egd import connection cursor=connection.cursor() +def yearStart(year): + return "{0}-01-01".format(year) + + def playerYear(name,year): query=""" select name, datum, win_count, game_count, rating_after, rating_after-rating_before @@ -11,8 +15,8 @@ def playerYear(name,year): where name=? and datum>=date(?) and datum=date(?)) as subq + join players_performance_tournaments as ppt on subq.pin=ppt.pin and subq.max_datum=ppt.datum + where ppt.p_country_code=?""" + + res=cursor.execute(query,(date2,date2,date1,country)) + print("pin\tcelé roky hraní\tprvní turnaj\trating") + for rec in res: + print("\t".join([str(x) for x in rec])) + + def populationStrength(): pass @@ -48,5 +68,5 @@ def populationAge(): # playerYear("Kotowski Jaroslav",2017) -# yearByCountry(2016) - +# yearByCountry(2017) +timeRank(2017,"CZ")