BIGINT UNSIGNED value is out of range

前端 未结 7 991
不知归路
不知归路 2020-12-03 09:48

I am getting the error

BIGINT UNSIGNED value is out of range in \'(1301980250 - mydb.news_articles.date)\'

7条回答
  •  南笙
    南笙 (楼主)
    2020-12-03 10:20

    The problem was caused by unsigned integer overflow as suggested by wallyk. It can be solved by

    1. using SELECT *, ((1 / log((date - 1301980250) * -1)) * 175) as weight FROM news_articles ORDER BY weight; (This one worked for me) `
    2. Changing sql_mode parameter in my.cnf to NO_UNSIGNED_SUBTRACTION (haven't checked this)

提交回复
热议问题