How can I select rows from a table by year only?
SELECT * FROM speckdata AS s WHERE DATE_FORMAT(s.localdate, '%Y') = '2014')
I could get the result in MySQL
Now on sqlite I get this error,
SQLiteManager: Likely SQL syntax error: SELECT* FROM speckdata AS s WHERE DATE_FORMAT(s.localdate, '%Y') = '2014') [ near ")": syntax error ] Exception Name: NS_ERROR_FAILURE Exception Message: Component returned failure code: 0x80004005 (NS_ERROR_FAILURE) [mozIStorageConnection.createStatement]
Any ideas?
EDIT:
If I change it to,
WHERE DATE(s.localdate, '%Y') = '2014'
It return no result.
BTW, the localdate is in date-time format such as 2014-10-09 14:59:53
SELECT * FROM speckdata AS s WHERE DATE_FORMAT(s.localdate, '%Y') = '2014'- sqluser2014year inlocaldate? - sqluser