I want to select the sum of values of my_field. The unit of my_field is in seconds. I don't want to exceed 24 hours, so when it exceeds 24 hours, I want it to select 24*60*60 = 86400.
SELECT IF(SUM(my_field) > 86400, 86400, SUM(my_field))
...
This solution doesn't seem to work. What else can I do?