How to fetch data between two dates

In Oracle I get result with this query - “SELECT login, datetime FROM log where ( (datetime between 2004-12-01and 2004-12-09) ) order by datetime DESC;” but this syntax doesn’t work in dremio. I am getting error “failure parsing the query”.

I got result using cast method “datetime between cast(‘2004-12-01’ as DATE) and cast(‘2004-12-09’ as DATE)”

Hi @vinay_sinha

Are you able to send the profiles for the query that failed with parsing error and the one that ran successfully?

I just ran the below query and it worked fine

SELECT FIRST_NAME, HIRE_DATE FROM EMPLOYEES where ((hire_date between '1987-06-17' and '1993-01-13')) order by hire_date desc
1 Like

Works for me as well.
I think you have to put those dates in single quotes.

1 Like

It’s working now. thank you.

Yes It’s working now. thank you.