I have a start_date_time INT UNSIGNED column in my table.
I have a query like this
... WHERE (g.start_date_time-$currentTime) > 0 ORDER BY (g.start_date_time-$currentTime)
And I get an error Numeric value out of range: 1690 BIGINT UNSIGNED value is out of range in.... If I set it to SIGNED of course everything works, but my question is is there a way to keep it UNSIGNED but anyway calculate negative values (I need just calculation, don’t need to store them anywhere), or I should redefine my query?
I think you should redefine as following
This will allow using indexes on g.start_date_time column and you don’t have to order by (g.start_date_time-$currentTime)