本帖最后由 viato 于 2013-04-01 10:50 编辑 mysqldumpslow 分析出来的日志如下,不知道怎么按Time从大到小排序 Count: 720 Time=2.17s (1560s) Lock=0.00s (0s) Rows=28627.0 (20611414), seach[seach]@2hosts SELECT head.aid, dat.dat_id, head.aid, head.label, head.short_desc, head.pack_name, head.dev_name, head.ltform , head.resolution , head.adk_version, head.state, ...
表j结构 id name order_sn 1 AA 0 2 AA 0 3 AA 0 4 AA 0 5 BB 0 6 BB 1 7 BB 0 8 CC 1 9 CC 1 想根据order_sn 取一个id的前后两个id 例如 id=6 前后两个id是 9-8-6-7-5 id=8 9-8-6-7-5 sql 怎么写 谢谢 了 各位
比如数据表中有字段id,分别有a1到a29的字符,如果查询时加入"order by id",排序会是a1,a10,a11...a19,a2,..a29,a3,a4...a9这样 怎样可以让它以a1,a2,a3....a28,a29这样排序输出呢?
mysql的排序问题 本人做一项目排序页面 项目的ID按指定次序存放如:23,1,5,3 现用where id in ( 23,1,5,3) 取记录 如何时做到该记录的次序也按 23,1,5,3 来排序
我在网上看到 SELECT * FROM `table` ORDER BY NEWID() 可以随机排序 我用了但出错 可能对能针对MS SQL SERVER 那 mysql 中如何实现
表结构如下: mysql> select * from test; +----+-------+ | id | name | +----+-------+ | 1 | test1 | | 2 | test2 | | 3 | test3 | | 4 | test4 | | 5 | test5 | +----+-------+ 执行以下SQL: mysql> select * from test where id in(3,1,5); +----+-------+ | id | name | +----+-------+ | 1 | test1 | | 3 | test3 | | 5 | test5 | +----+-------+ 3 rows in set (0.00 sec) 这个select在mysql中得结果会自动按照...
表结构如下: mysql> select * from test; +----+-------+ | id | name | +----+-------+ | 1 | test1 | | 2 | test2 | | 3 | test3 | | 4 | test4 | | 5 | test5 | +----+-------+ 执行以下SQL: mysql> select * from test where id in(3,1,5); +----+-------+ | id | name | +----+-------+ | 1 | test1 | | 3 | test3 | | 5 | test5 | +----+-------+ 3 rows in set (0.00 sec) 这个select在mysql中得结果会自动按照...
例如: select Id from Info where Id order by Id; +----------+ | Id | +----------+ | 10001 | | 100010 | <---这里.如果按我的设想.这句应该排到最后面.请问要如何解决这 | 10002 | 个问题? 谢谢. | 10004 | +----------+
本帖最后由 cenalulu 于 2012-06-29 17:13 编辑 版本环境,mysql5.5以上 测试数据建立代码如下:[code]-- -------------------------------------------------------- -- Host: 127.0.0.1 -- Server version: 5.5.21-log - mysql Community Server (GPL) -- Server OS: Win64 -- HeidiSQL version: 7.0.0.4140 -- Date/time: 2012-05...