Search code examples
sqloperatorsfilteringpresto

SQL date filter operator


Just a general date filter question, what are the valid operators for me to filter a specific timeframe as I had this error:

Cannot apply operator: date <= varchar(8)

code:

where utc_date >= '2022-04-01'    

data type = date


Solution

  • '2022-04-01' is a varchar literal, you need to convert it to date for example by prefixing it with date:

    where utc_date >= date '2022-04-01'