dimanche 8 mars 2015

Select data with current year

I want to get all data from my table with only current year. So, my table: DataApp. Column: id (integer), name(text), mydate(date)



----------------------------------
| id | name | mydate |
----------------------------------
| 1 | first | 01.01.2011 |
----------------------------------
| 2 | second | 09.03.2015 |
----------------------------------


I want to get only row with date 09.03.2015. I try to work with function strftime, because I develop for Android and function YEAR doesn't work.


I try it:



SELECT mydate FROM DataApp WHERE strftime('%Y', mydate) = '2015';


Column mydate is not involved in the comparison. How can I get year from mydate for comparison with '2015' in WHERE?


Aucun commentaire:

Enregistrer un commentaire