The `expression` following HAVING must evaluate to a number which is interpreted as a boolean (True or False -- False is zero or null, and True is non-zero). The expression `max(time_out)` evaluates to '00:24' which, when converted to numeric, is zero or false. ``` sqlite> select cast('00:24' as numeric); ┌──────────────────────────┐ │ cast('00:24' as numeric) │ ├──────────────────────────┤ │ 0 │ └──────────────────────────┘ sqlite> ``` If I can divine your intention properly, what you probably mean is: ``` select name, dt, time_in, max(time_out) from log where dt > '2021-03-13' group by dt, time_in ; ```