I have a problem to make a query for view data in postgresql. I want to view data with 2 condition :
- where employeeId
- and between daterange
Heres my Query:
Select *
from employee
where employeeId = 3
and date(created_at) = between '2022-08-29' and '2022-08-31'
I have run that query but show error:
Reason:
SQL Error [42601]: ERROR: syntax error at or near "date" Position: 1`
The type data of column created_at
is timestamp.
My questions is: What is correct query for view data from that conditions?
2
Answers
You can use arithmetic operation
Remove the
=
operator from your query, theBETWEEN
does not require the=