I have the below query for a table that has records that include dates from Jan 1st - March 31st of a previous year. When I run this query as below there are some records returned that are beyond 2023-02-05, for example some records that are returned have an event_time of 2023-02-27. I'm not sure why I'm getting records beyond the specified date, I am expecting to only see records returned with an event_time between the two specified dates.
Can someone provide input on what is wrong with my query that is causing it to return rows beyond the specified dates?
Note I have also tried using BETWEEN like
WHERE event_time BETWEEN to_date('2023-01-01', 'yyyy-mm-dd') AND to_date('2023-02-05', 'yyyy-mm-dd') but I get the same results.
SELECT id, event_time
FROM table
WHERE event_time >= to_date('2023-01-01', 'yyyy-mm-dd') AND event_time <= to_date('2023-02-05', 'yyyy-mm-dd')
AND id = '541'OR id = '883' OR id = '959' OR id = '461'
ORDER BY event_time desc;
Using Oracle Database 19c Standard Edition 2 Release 19.0.0.0.0 - Production Version 19.22.0.0.0