求个SQL语句,不要选择集合的第一条记录。

JGH8041 2007-12-18 09:38:53
求个SQL语句,不要选择集合的第一条记录。
...全文
117 9 打赏 收藏 转发到动态 举报
AI 作业
写回复
用AI写文章
9 条回复
切换为时间正序
请发表友善的回复…
发表回复
cxmcxm 2007-12-18
  • 打赏
  • 举报
回复
应该指定主鍵与排序才能确定第一条的位置
w2jc 2007-12-18
  • 打赏
  • 举报
回复
不知道LZ这个需求的用途,
如果是在程序里面使用的话,就先简单返回一个结果集,忽略第一条记录即可。
中国风 2007-12-18
  • 打赏
  • 举报
回复
猜一个:
select * from t where binary_checksum(*) not in(select top 1 binary_checksum(*) from t)
arrow_gx 2007-12-18
  • 打赏
  • 举报
回复
真的搞不懂LZ的意思,只是单纯是不要第一条吗? 有什么条件呢,没有的话,有N多写法,下面几句都可以



select * from tb where id <max(id) order by id desc

select * from tb where id >min(id) order by id

select * from tb where id not in (select min(id) from tb) order by id

select * from tb where id not in (select max(id) from tb) order by id desc





dawugui 2007-12-18
  • 打赏
  • 举报
回复
这是啥意思?

select * from tb where id not in (select top 1 id from tb)
catvv 2007-12-18
  • 打赏
  • 举报
回复
除了以上的还有:
效率低一点的:

SELECT 字段 FROM table1 where 字段 not in (select top 1 字段 from table1)
-狙击手- 2007-12-18
  • 打赏
  • 举报
回复
结构是怎么的
benbenkui 2007-12-18
  • 打赏
  • 举报
回复
select top(n-1)* from tb ordey by indexcol desc
--n 记录数。
--indexcol 您需要排序的列
pt1314917 2007-12-18
  • 打赏
  • 举报
回复

这样?
select bh=identity(int,1,1),* into #temp from 表名
select * from #temp where bh>1

34,838

社区成员

发帖
与我相关
我的任务
社区描述
MS-SQL Server相关内容讨论专区
社区管理员
  • 基础类社区
  • 二月十六
  • 卖水果的net
加入社区
  • 近7日
  • 近30日
  • 至今
社区公告
暂无公告

试试用AI创作助手写篇文章吧