jeudi 10 mars 2016

sqlite3 Python select between dates

I'm trying to select cost from my table between two user inputed dates:

date_sql = "SELECT cost FROM Finance WHERE date BETWEEN '"+str(fd)+"' AND '"+str(dateadd)+"'"
print date_sql
month_price = [t[0] for t in cur.execute(date_sql)]
print month_price

I receive this output:

SELECT cost FROM Finance WHERE date BETWEEN '2016-03-06' AND '2016-03-09'
[]

So the format looks good to me, but its not selecting any values (There are values for those dates). I'm confused why it isn't selecting anything?

Thanks!

Aucun commentaire:

Enregistrer un commentaire