mysql两列想减负数显示问题

hehe4569 2010-07-16 08:51:47
mysql> select idd-id,id,idd,name from test order by 1 desc ;
+----------------------+------+-----+------+
| idd-id | id | idd | name |
+----------------------+------+-----+------+
| 18446744073709551614 | 10 | 8 | |
| 199 | 1 | 200 | |
| 46 | 4 | 50 | |
| 37 | 3 | 40 | |
| 28 | 2 | 30 | |
| 1 | 1 | 2 | |
+----------------------+------+-----+------+
为什么不是负数???
...全文
190 5 打赏 收藏 转发到动态 举报
写回复
用AI写文章
5 条回复
切换为时间正序
请发表友善的回复…
发表回复
hehe4569 2010-07-16
  • 打赏
  • 举报
回复
OK 谢谢
WWWWA 2010-07-16
  • 打赏
  • 举报
回复
测试,确实是unsigned引起的,去掉后,
结果正常
hehe4569 2010-07-16
  • 打赏
  • 举报
回复
mysql> show create table test;
+-------+----------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------+
| Table | Create Table |
+-------+----------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------+
| test | CREATE TABLE `test` (
`id` int(11) default NULL,
`idd` int(10) unsigned NOT NULL,
`name` mediumtext NOT NULL,
KEY `id` (`id`),
KEY `idd` (`idd`),
KEY `idd_2` (`idd`,`id`)
) ENGINE=InnoDB DEFAULT CHARSET=gbk |
+-------+----------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------+
1 row in set (0.00 sec)

mysql>

是那个unsigned引起的么????????
hehe4569 2010-07-16
  • 打赏
  • 举报
回复
mysql> select * from test;
+------+-----+------+
| id | idd | name |
+------+-----+------+
| 1 | 200 | |
| 2 | 30 | |
| 3 | 40 | |
| 4 | 50 | |
| 1 | 2 | |
| 10 | 8 | |
| -1 | 0 | |
| NULL | 0 | |
+------+-----+------+
8 rows in set (0.00 sec)

mysql> select id-idd from test;
+----------------------+
| id-idd |
+----------------------+
| NULL |
| 18446744073709551615 |
| 18446744073709551615 |
| 2 |
| 18446744073709551588 |
| 18446744073709551579 |
| 18446744073709551570 |
| 18446744073709551417 |
+----------------------+
8 rows in set (0.00 sec)

mysql>
WWWWA 2010-07-16
  • 打赏
  • 举报
回复
18446744073709551614 | 10 | 8 | |
你的记录是什么,贴出来

56,679

社区成员

发帖
与我相关
我的任务
社区描述
MySQL相关内容讨论专区
社区管理员
  • MySQL
加入社区
  • 近7日
  • 近30日
  • 至今
社区公告
暂无公告

试试用AI创作助手写篇文章吧