数据库里已有的端口资料类似:serial0/0,serial0/1,serial3/0,serial3/1,ethernet2/0,ethernet2/1到ethernet2/24,如果直接用order by port会出现ethernet排在serial之前,及2/11排在2/2之前类似的问题,我想按照端口编号来排序,结果希望是这样的:0/0,0/1,2/0....2/24,3/0,3/1,谢谢
解决方案 »
- mysql 语句有错误...求帮忙
- Mysql Like 问题
- left right inner Join 多表联查的问题(附实际例子)!
- 我刚装了mysql 可是在测试MySQL工作是否正常的时候遇到了问题
- 关于mysql6.0数据库同步方式有哪些
- 这个包有没有说明文档的啊?
- 【100分】帮我看看我这个数据库设计错在什么地方?
- MySQL出错1016: Can't open file: 'mw_objectcache.MYI',请大家帮忙,在线等~
- mysql system error 110错误 如何解决
- 随机出现 PHP Warning: mysql_connect()
- Postgres的permission deniey问题
- mysql加密问题
比如:
... order by substring(...);
具体用法看手册:
SUBSTRING(str,pos), SUBSTRING(str FROM pos), SUBSTRING(str,pos,len), SUBSTRING(str FROM pos FOR len) The forms without a len argument return a substring from string str starting at position pos. The forms with a len argument return a substring len characters long from string str, starting at position pos. The forms that use FROM are standard SQL syntax. It is also possible to use a negative value for pos. In this case, the beginning of the substring is pos characters from the end of the string, rather than the beginning. A negative value may be used for pos in any of the forms of this function. For all forms of SUBSTRING(), the position of the first character in the string from which the substring is to be extracted is reckoned as 1. mysql> SELECT SUBSTRING('Quadratically',5);
-> 'ratically'
mysql> SELECT SUBSTRING('foobarbar' FROM 4);
-> 'barbar'
mysql> SELECT SUBSTRING('Quadratically',5,6);
-> 'ratica'
mysql> SELECT SUBSTRING('Sakila', -3);
-> 'ila'
mysql> SELECT SUBSTRING('Sakila', -5, 3);
-> 'aki'
mysql> SELECT SUBSTRING('Sakila' FROM -4 FOR 2);
-> 'ki'