Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

SQLite less than operator problem

Tags:

sqlite

I am using SQLite for a project and < symbol is not working in the query.

There is a table named Holidays which has a field of datatype datetime.

Suppose the table contains some dates of current year in the column HolidayDate.

SELECT HolidayDate
  FROM Holidays
 WHERE (HolidayDate >= '1/1/2011')
   AND (HolidayDate <= '1/1/2012')

The < symbol in the above query is not working. > symbol in the above query is working well.

Please help me.

like image 330
Aneesh Daniel Avatar asked May 04 '11 09:05

Aneesh Daniel


1 Answers

Try:

SELECT HolidayDate
  FROM Holidays
 WHERE HolidayDate >= date('2011-01-01')
   AND HolidayDate <= date('2012-01-01')

(date format must be YYYY-MM-DD)

like image 112
manji Avatar answered Nov 15 '22 11:11

manji