order by 的小问题 select top 10 * from table1 where id>=10 order by id不知道行不行,不过声明,我也只是一个初学者。 解决方案 » 免费领取超大流量手机卡,每月29元包185G流量+100分钟通话, 中国电信官方发货 你们没明白我的意思,我再说详细些:表“基本号码表”中有如下记录(id为PK):有语句:select id,openday from 基本号码表id openday ----------- ------- 13 20010802 20010813 20010824 20010835 20010846 20010857 20010868 20010879 200108810 200108911 200109012 200109115 200109320 200109421 200109522 200109623 200109714 2001092(可看出,默认是以openday升序排列)现在要取出openday最大的10个记录,id openday ----------- ------- 23 200109722 200109621 200109520 200109415 200109314 200109212 200109111 200109010 20010899 2001088所以有如下语句:select a.* from (select top 10 id,openday from 基本号码表 order by openday desc) as a order by a.openday asc上面的结果有个问题,即是以openday降序在排列,但我要求是升序(外层的asc没起作用),即:2001088、2001089...2001097刚才只不过为了简化问题,所以只提了一个字段。注:id只是用来表示唯一性,要求只从openday考虑。 上微软网站上把sql server 2000的sp2当下来,安装上就好了。 我的是 SQL Server7.0,与这有关?(再次试了,还是那样) select count(*) from 基本号码表 as a where (select count(*) from 基本号码表 as b where a.openday<b.openday )<10 你嵌套的select top 10 id,openday from 基本号码表 order by openday desc取出的只是最小的十个,当然不对,你可以改成升序,或取最后十个 怎么判断表中的数据增加了 求助一条SQL语句。 字符串排序问题 有SQL语句可以获得数据库服务器IP的么? mysql数据库连接问题 如何实现这种统计 关于SQL数据库连接(急) sql关于DATEADD()函数的使用 求助!!存储过程前台调用耗时问题 希望大佬帮我看一下哪里错了 如何在Excel中使用SQL SERVER数据源? 怎样用ADO连接db2的数据库(C++Build中)
表“基本号码表”中有如下记录(id为PK):
有语句:select id,openday from 基本号码表id openday
----------- -------
13 2001080
2 2001081
3 2001082
4 2001083
5 2001084
6 2001085
7 2001086
8 2001087
9 2001088
10 2001089
11 2001090
12 2001091
15 2001093
20 2001094
21 2001095
22 2001096
23 2001097
14 2001092
(可看出,默认是以openday升序排列)现在要取出openday最大的10个记录,
id openday
----------- -------
23 2001097
22 2001096
21 2001095
20 2001094
15 2001093
14 2001092
12 2001091
11 2001090
10 2001089
9 2001088
所以有如下语句:
select a.* from (select top 10 id,openday from 基本号码表 order by openday desc) as a order by a.openday asc
上面的结果有个问题,即是以openday降序在排列,但我要求是升序(外层的asc没起作用),即:2001088、2001089...2001097
刚才只不过为了简化问题,所以只提了一个字段。
注:id只是用来表示唯一性,要求只从openday考虑。
select top 10 id,openday from 基本号码表 order by openday desc
取出的只是最小的十个,当然不对,
你可以改成升序,或取最后十个