社区
MS-SQL Server
帖子详情
怎么写select可以得到某几条符合规则的记录
idoloveyou
2003-10-15 05:42:39
怎么写select可以得到某几条符合规则的记录
比如我想得到第5-8条记录,怎么写?
...全文
94
6
打赏
收藏
怎么写select可以得到某几条符合规则的记录
怎么写select可以得到某几条符合规则的记录 比如我想得到第5-8条记录,怎么写?
复制链接
扫一扫
分享
转发到动态
举报
写回复
配置赞助广告
用AI写文章
6 条
回复
切换为时间正序
请发表友善的回复…
发表回复
打赏红包
gmlxf
2003-10-15
打赏
举报
回复
5-8这4条记录(降序)
select top 4 * from
(select top 8 * from 表 order by id) a
order by id desc
5-8这4条记录(升序)
select * from
(
select top 4 * from
(select top 8 * from 表 order by id) a
order by id desc
) a
order by id
gmlxf
2003-10-15
打赏
举报
回复
5-8这4条记录(降序)
select top 4 * from
(select top 8 * from 表 order by id) a
order by iddesc
5-8这4条记录(升序)
select * from
(
select top 4 * from
(select top 8 * from 表 order by id) a
order by id desc
) a
order by id
idoloveyou
2003-10-15
打赏
举报
回复
子查询最多能返回一个记录
yujohny
2003-10-15
打赏
举报
回复
ID是表的主键
select top 4 * from 表 where id= (select top 8 from 表 order by id)
order by id desc
yujohny
2003-10-15
打赏
举报
回复
select top 4 from 表 where id= (select top 8 from 表 order by id)
order by id desc
pengdali
2003-10-15
打赏
举报
回复
select IDENTITY(int, 1,1) AS ID_Num,* into #temp from 表
select * from #temp where ID_Num between 10 and 20
MySQL 四类管理日志(详解及高阶配置)
:
记录
建立的客户端连接和执行的语句(
记录
SELECT
语句)。 4) 慢查询日志:
记录
所有执行时间超过指定秒或不使用索引的查询。 # 更改数据的语句 1) DDL 语句和 DML 语句对数据库的更改操作 2) DDL 语言:...
php查询
符合
条件的总数,SQL查询数据库中
符合
条件的
记录
的总数
1.
select
count(*) from table; //统计元组个数2.
select
count(列名) from table; //统计一列中值的个数3.... //
符合
该条件的
记录
总数4. sql_count = "
select
count(*) from article a where 1=1 ";//...
关于oracle多条
记录
合并为一条
记录
的方法
今天正还有同学问了一个...经过沟通发现,同学的需求不是这个样子的,是要求一条sql语句获取两条
记录
并合并他们,数据库学的比较菜,上来就
写
了一个很白痴的sql
select
id, (
select
col from table where id=t.id and
mysql中
select
使用方法_MySQL中
select
语句介绍及使用示例
MySQL中
select
语句介绍及使用示例发布时间:2018-04-15 09:57:01数据表都已经创建起来了,假设我们已经插入了许多的数据,我们就可以用自己...也可以只选取某一个数据行里的某一个数据列
select
birth from president...
sql -- 查出某行数据的上下条数据
接上篇sql 排序,排序后,可...依旧是上文的例子,如下图,假如要查“工单号为‘order005’的下一条数据”:实现:
select
* from (
select
Date 日期,OrderID 工单号,OrderSeq 工单顺序,Row_Number() over(order by ...
MS-SQL Server
34,575
社区成员
254,585
社区内容
发帖
与我相关
我的任务
MS-SQL Server
MS-SQL Server相关内容讨论专区
复制链接
扫一扫
分享
社区描述
MS-SQL Server相关内容讨论专区
社区管理员
加入社区
获取链接或二维码
近7日
近30日
至今
加载中
查看更多榜单
社区公告
暂无公告
试试用AI创作助手写篇文章吧
+ 用AI写文章