How properly use such query with date intervals
@SqlUpdate("delete fromlogin where created < now() - ':days days' :: interval")
void deleteOldLogin(@Bind("days") Period days);
You can't pass the number of days inside an interval constant as a parameter. You need to pass an integer specifying your number of days, then multiply that with an interval of the desired length.
@SqlUpdate("delete fromlogin where created < now() - :days * '1 day'::interval")
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With