sql - Android SQLite not selecting date -
i have sqlite database in app stores date in format of yyyy-mm-dd hh:mm:ss
i love query transaction happend on month of of year code not working don't know why. query shown below, please advice.
select count(id_sale) total_transactions,sold_to, strftime('%m', sale_date) month, strftime('%y', sale_date) year, sale_date sales month=5 , year=2015
after research discovered reason had casting work. here answer below. down vote anyway.
select count(id_sale) total_transactions,sold_to, cast(strftime('%m', sale_date) integer) month, cast(strftime('%y', sale_date) integer) year, sale_date sales month=5
Comments
Post a Comment