BIGINT UNSIGNED值超出范围

我收到错误

BIGINT UNSIGNED值超出范围在’(1301980250 - 。。mydb )’news_articles``date

当我运行查询

SELECT *, ((1 / log(1301980250 - date)) * 175) as weight FROM news_articles ORDER BY weight;

删除ORDER BY条件,也将删除错误。我该如何解决?

日期字段包含UNIX时间戳(例如:1298944082)。我将MySQL从5.0.x升级到5.5.x后开始出现错误

有什么帮助吗?

回答:

我最近遇到了这个问题,并找到了最合理的解决方案,可以将任何UNSIGNED整数简单地转换为SIGNED。

 SELECT *, ((1 / log(1301980250 - cast(date as signed)) * 175) as weight FROM news_articles ORDER BY weight

以上是 BIGINT UNSIGNED值超出范围 的全部内容, 来源链接: utcz.com/qa/435366.html

回到顶部