BIGINT UNSIGNED值超出范围 [英] BIGINT UNSIGNED value is out of range

查看:486
本文介绍了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条件,也将删除错误.我该如何解决?

Removing the ORDER BY condition, removes the error too. How can I fix it?

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

Update: The date field contains unix timestamp (ex: 1298944082). The error started appearing after I upgraded MySQL from 5.0.x to 5.5.x

请帮忙吗?

推荐答案

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

I recently ran into this and found the most reasonable solution to simply cast any UNSIGNED ints as SIGNED.

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

这篇关于BIGINT UNSIGNED值超出范围的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆