mysql数据库里存的是CHAR类型,利用价格排序显示在页面如何排序?哪位高手赐教,求解.感谢
2012-12-10
展开全部
mysql 使用 CAST 函数 或者 Convert 函数, 实现 字符转数字 的处理操作
例如:
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)
例如:
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)
推荐律师服务:
若未解决您的问题,请您详细描述您的问题,通过百度律临进行免费专业咨询