我有一些MySQL代碼:MySQL的錯誤代碼:1264超範圍值的列「計數」在第1行
CREATE TABLE test_table (
id int(11) NOT NULL AUTO_INCREMENT,
count int(10) unsigned DEFAULT NULL,
PRIMARY KEY (id)
) ENGINE=MyISAM AUTO_INCREMENT=4 DEFAULT CHARSET=latin1;
insert into test_table (count) values (1);
update test_table set count = IF(count -1 < 0, 0 , count -1);
update test_table set count = IF(count -1 < 0, 0 , count -1);
這應該設置如果(count -1) < 0
計數到零。
我得到一個錯誤:
Error Code: 1264 Out of range value for column 'count' at row 1` instead.
這是由於數是一個unsigned int。如果我使用一個有符號的整數它的作品。
這是MySQL中的錯誤嗎?我使用的是:mysql Ver 14.14 Distrib 5.1.46sp1, for Win32 (ia32)
這不是一個錯誤 http://bugs.mysql.com/bug.php?id=2454 – 2011-09-19 03:50:20