jeudi 30 juillet 2015

Android SQLite not selecting date

I have an SQlite database in my app that stores the date in the format of yyyy-MM-dd HH:mm:ss

I would love to query a transaction that happend on a certain month of of year but my code is not working I don't know why. My query is shown below, please advice.

SELECT COUNT(id_sale) AS total_transactions,sold_to, 
strftime('%m', sale_date) AS month, 
strftime('%Y', sale_date) AS year,
sale_date FROM sales  WHERE  month=5 AND year=2015

Aucun commentaire:

Enregistrer un commentaire