I have written this script:
SELECT id_pass, max(dt) FROM parking_pass_move
WHERE type_error is null and id_pass = 1784
GROUP BY id_pass
HAVING max(dt) < '2021-07-02'
OK! But when I change my having row to:
HAVING max(dt) < '2021-07-01'
Or even:
HAVING max(dt) < '2021-06-27'
Such data definitely exists, so I don't understand what to do:
result
I tried to change 'dt' to date and timestamp, tried to do same with date in having row. It didn't help.
My aim with this code is to take last move for selected pass and date.