mardi 26 mai 2015

SQLite - select row by year only?

How can I select rows from a table by year only?

SELECT * FROM speckdata AS s WHERE DATE_FORMAT(s.localdate, '%Y') = '2014') -- this how I would do it with MySQL --

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.

Aucun commentaire:

Enregistrer un commentaire