1个回答
展开全部
可以用函数RIGHT(字段名,1)
例如:
mysql> create table DECIMALTEST(ID INT NOT NULL AUTO_INCREMENT,VAL DECIMAL
PRIMARY KEY(ID))ENGINE=INNODB,DEFAULT CHARSET=UTF8;
Query OK, 0 rows affected (0.28 sec)
mysql> INSERT INTO DECIMALTEST (VAL) VALUES (111.3),(213.5);
Query OK, 2 rows affected (0.08 sec)
Records: 2 Duplicates: 0 Warnings: 0
mysql> SELECT RIGHT(VAL,1) FROM DECIMALTEST;
+--------------+
| RIGHT(VAL,1) |
+--------------+
| 3 |
| 5 |
+--------------+
2 rows in set (0.02 sec)
例如:
mysql> create table DECIMALTEST(ID INT NOT NULL AUTO_INCREMENT,VAL DECIMAL
PRIMARY KEY(ID))ENGINE=INNODB,DEFAULT CHARSET=UTF8;
Query OK, 0 rows affected (0.28 sec)
mysql> INSERT INTO DECIMALTEST (VAL) VALUES (111.3),(213.5);
Query OK, 2 rows affected (0.08 sec)
Records: 2 Duplicates: 0 Warnings: 0
mysql> SELECT RIGHT(VAL,1) FROM DECIMALTEST;
+--------------+
| RIGHT(VAL,1) |
+--------------+
| 3 |
| 5 |
+--------------+
2 rows in set (0.02 sec)
已赞过
已踩过<
评论
收起
你对这个回答的评价是?
推荐律师服务:
若未解决您的问题,请您详细描述您的问题,通过百度律临进行免费专业咨询