发布网友 发布时间:2022-04-23 01:04
共4个回答
热心网友 时间:2022-04-30 09:41
数字转字符
mysql> SELECT CONCAT ( CAST(1 as char) , '2') AS test;
+------+
| test |
+------+
| 12 |
+------+
1 row in set (0.00 sec)
mysql> SELECT CONCAT ( Convert(1, char) , '2') AS test;
+------+
| test |
+------+
| 12 |
+------+
1 row in set (0.00 sec)
字符转数字
mysql> SELECT CAST('1' as SIGNED) + 100 AS test;
+------+
| test |
+------+
| 101 |
+------+
1 row in set (0.00 sec)
mysql> SELECT Convert('1' , SIGNED) + 100 AS test;
+------+
| test |
+------+
| 101 |
+------+
1 row in set (0.00 sec)
热心网友 时间:2022-04-30 10:59
把你上面的int换成SIGNED就行了。追问不行,我的是mysql数据库
热心网友 时间:2022-04-30 12:34
select sum(cast(列1 as signed)) from 表1
热心网友 时间:2022-04-30 14:25
mysql DATE值的格式是'YYYY-MM-DD'
java中Date值得格式是是'YYYY-MM-DD HH:mm:ss'
你需要在java中自己日期转换方法,或者把mssql的字段类型改成datetime