I have the following query which works as expected.

It updates if a matching id exists and timestamp falls within the range I am looking for.

I am not able to validate against an exact timestamp value as the request coming in will only match timing approximately (missing by a few milliseconds) thus having to find a match by truncating it as follows.

```
UPDATE myTable SET code=1, WHERE id=50 
and 
start_ts >= date_trunc('day', cast('2020-10-03 13:34:51.947000' as TIMESTAMP))
and 
start_ts < date_trunc('day', cast('2020-10-03 13:34:51.947000' as TIMESTAMP)) + interval '1 day';

```

Is there a way to do this without having to use the date\_trunc method and castings, or at least reduce the casting to be only performed once since it is a repetition?

Please advice. Thanks.