I am with a problem like in this topic. and I've tried 'unixepoch', but even so, my recordset returns None
running the sql below directly in sqliteman, i have as return, the value that I expected
SELECT sum(value)
FROM customers
WHERE customer_id = 1
AND devolution = 'No'
AND strftime('%Y', delivery_date) IN ('2016')
but, when in python, I get None as return from the print self.rec[0]
def get_total_from_last_year(self):
self.now = datetime.datetime.now()
self.lastYear = self.now.year -1
self.con = sqlite3.connect(database.name)
self.cur = self.con.cursor()
self.sql = """SELECT sum(value)
FROM customers
WHERE customer_id=?
AND devolution='No'
AND strftime('%%Y',delivery_date) IN(%s) """ %(str(self.lastYear))
self.cur.execute(self.sql, str(customerID))
self.rs = self.cur.fetchall()
for self.rec in self.rs:
print self.rec[0]
Someone can help me? Thank you very much.