社区
MS-SQL Server
帖子详情
sql语句问题 急!!!!!!
natato
2008-09-16 09:21:36
我想查询表中前十个数据,安id查 怎么写?
我用top不对,谢谢!!!!
...全文
72
9
打赏
收藏
sql语句问题 急!!!!!!
我想查询表中前十个数据,安id查 怎么写? 我用top不对,谢谢!!!!
复制链接
扫一扫
分享
转发到动态
举报
写回复
配置赞助广告
用AI写文章
9 条
回复
切换为时间正序
请发表友善的回复…
发表回复
打赏红包
Garnett_KG
2008-09-16
打赏
举报
回复
...
什么网络.
lanmengxjh
2008-09-16
打赏
举报
回复
select top 10* from table where id ......
lgxyz
2008-09-16
打赏
举报
回复
看不到帖?
Garnett_KG
2008-09-16
打赏
举报
回复
SELECT TOP 10 * FROM Table ORDER BY ID
水族杰纶
2008-09-16
打赏
举报
回复
M-N紀錄
1.
select top m * into 临时表(或表变量) from tablename order by columnname -- 将top m笔插入
set rowcount n
select * from 表变量 order by columnname desc
2.
select top n * from
(select top m * from tablename order by columnname) a
order by columnname desc
3.
如果tablename里没有其他identity列,那么:
select identity(int) id0,* into #temp from tablename
取n到m条的语句为:
select * from #temp where id0 >=n and id0 <= m
如果你在执行select identity(int) id0,* into #temp from tablename这条语句的时候报错,那是因为你的DB中间的select into/bulkcopy属性没有打开要先执行:
exec sp_dboption 你的DB名字,'select into/bulkcopy',true
4.
如果表里有identity属性,那么简单:
select * from tablename where identitycol between n and m
twgxzjk
2008-09-16
打赏
举报
回复
SET ROWCOUNT 10
select * from t
SET ROWCOUNT 0
Garnett_KG
2008-09-16
打赏
举报
回复
SELECT TOP 10 * FROM Table ORDER BY ID
Garnett_KG
2008-09-16
打赏
举报
回复
SELECT TOP 10 * FROM Table ORDER BY ID
liangCK
2008-09-16
打赏
举报
回复
select top 10 * from tb order by id
hibernate管理的
sql语句
中使用in
急
!!!(解决)
在配置文件中写了
sql语句
,需要传参,使用了占位符 :XXX [code="java"] select b.BILL_START_CODE b from dbo.LNRVS_BANK_ACCEPTANCE_BILL b ACCEPTANCE_BILL_STATE in (:billState) [/code] 部分
sql语句
已省略 [code="java"] S...
急
急
急
!
SQL语句
年龄段人数汇总查询 怎么更改语句类型!!!
select a.orgcode, a.orgname, a.nd, a.yd, sum(case when substr(to_char(sysdate,‘yyyymmdd’),1,4)-substr(to_char(a.csrq08,‘yyyymmdd’),1,4)<=29 then 1 else 0 end ) as aaa,–‘29岁以下’ sum(case when substr(...
oracle修改的
sql语句
,请教oracle高手
SQL语句
该怎么修改,如何写。
当前位置:我的异常网» Oracle开发»请教oracle高手
SQL语句
该怎么修改,如何写。请教oracle高手
SQL语句
该怎么修改,如何写。www.myexceptions.net网友分享于:2013-02-04浏览:18次请问oracle高手
SQL语句
该如何修改,怎么写。
急
!!!后台为ORACEL数据库:select A.SORDER,A.KOTECD,A.JSTSTM,A....
求BOM展开的SQL!HELP!!
急
!
新年好!BOM展开方面的
问题
请教高手:在manuf_structure表中,其主要字段是PARENT_PART与COMPONENT_PART 当我用下记SQL:select parent_part,component_part ...
使用游标的
SQL语句
使用游标的
SQL语句
必须使用游标的
SQL语句
有查询结果为多条记录的select语句,current形式的update和delete语句。 查询结果为多条记录的select语句 一般情况下,select语句查询结果为多条记录,因此需要使用游标机制将多条记录一次一条的送主程序处理,从而把集合的操作转换为对单个记录的处理,使用游标的步骤为: 1:说明游标 用declare语句为一条select语句定义游标: exec SQL declare <游标名> cursor for <select语句
MS-SQL Server
34,873
社区成员
254,640
社区内容
发帖
与我相关
我的任务
MS-SQL Server
MS-SQL Server相关内容讨论专区
复制链接
扫一扫
分享
社区描述
MS-SQL Server相关内容讨论专区
社区管理员
加入社区
获取链接或二维码
近7日
近30日
至今
加载中
查看更多榜单
社区公告
暂无公告
试试用AI创作助手写篇文章吧
+ 用AI写文章