I'm trying to filter by date in a SQL query as follows.
select *
from table_name
where date_col="2015-04-02"
limit 5
I'm getting an error as follows.
DatabaseError: Execution failed on sql '
select *
from table_name
where date_col="2015-04-02"
limit 5
': column "2015-04-02" does not exist
LINE 4: where date_col="2015-04-02"
Date 2015-04-02 exists in the database. What am I missing here? I really appreciate any help you can provide.
CodePudding user response:
You must use single quotes in where
clause, double quotes are used in column identifier or reserved words.
select *
from table_name
where date_col = '2015-04-02'
limit 5