惯性聚合 高效追踪和阅读你感兴趣的博客、新闻、科技资讯
阅读原文 在惯性聚合中打开

推荐订阅源

TaoSecurity Blog
TaoSecurity Blog
T
Troy Hunt's Blog
cs.AI updates on arXiv.org
cs.AI updates on arXiv.org
Vercel News
Vercel News
T
Threatpost
G
Google Developers Blog
T
Threat Research - Cisco Blogs
Threat Intelligence Blog | Flashpoint
Threat Intelligence Blog | Flashpoint
T
The Exploit Database - CXSecurity.com
H
Heimdal Security Blog
Google DeepMind News
Google DeepMind News
Cyberwarzone
Cyberwarzone
T
The Blog of Author Tim Ferriss
Know Your Adversary
Know Your Adversary
Hacker News: Ask HN
Hacker News: Ask HN
www.infosecurity-magazine.com
www.infosecurity-magazine.com
S
Schneier on Security
B
Blog
V2EX - 技术
V2EX - 技术
NISL@THU
NISL@THU
C
CERT Recently Published Vulnerability Notes
W
WeLiveSecurity
C
Cybersecurity and Infrastructure Security Agency CISA
cs.CV updates on arXiv.org
cs.CV updates on arXiv.org
Y
Y Combinator Blog
K
KPMG report finds enterprise disconnect between AI and its ROI | CIO
Spread Privacy
Spread Privacy
The Last Watchdog
The Last Watchdog
V
Vulnerabilities – Threatpost
N
Netflix TechBlog - Medium
Schneier on Security
Schneier on Security
F
Fortinet All Blogs
N
News | PayPal Newsroom
Attack and Defense Labs
Attack and Defense Labs
Blog — PlanetScale
Blog — PlanetScale
OSCHINA 社区最新新闻
OSCHINA 社区最新新闻
Microsoft Security Blog
Microsoft Security Blog
S
Security @ Cisco Blogs
人人都是产品经理
人人都是产品经理
爱范儿
爱范儿
P
Privacy & Cybersecurity Law Blog
P
Proofpoint News Feed
Project Zero
Project Zero
I
Intezer
罗磊的独立博客
H
Hackread – Cybersecurity News, Data Breaches, AI and More
酷 壳 – CoolShell
酷 壳 – CoolShell
博客园 - Franky
SecWiki News
SecWiki News
Martin Fowler
Martin Fowler

博客园 - 狂野都城

一次分布式事务管理器(MSDTC)的事务处理异常的排错 后台线程处理 FMS3.5 的logs 日志目录配置 C#磁盘大小管理操作类 C#建立IIS虚拟目录站点 IO操作类 同步和异步方式获取网页源代码! 判断一幅图片是否是黑色,灰度直方图 winform窗体置前 关于FMS服务端数据流发布 如何配置FMS边缘服务器 Windows服务“允许服务与桌面交互”的使用和修改方法 招聘:Flash视频开发程序员(网络多媒体应用) 招聘:windows mobile 手机应用软件的开发 Word 2007 里头鼠标失效(滚轮除外) ,困扰多天! 终止线程 Response.End 在Asp.net 里面的正确使用 一道小学数学题... net常用代码 (收藏) 在VS2005 开发中使用Codesmith 和NetTiers 模版开发相关
Access 中查询TOP语句的奇怪问题???
狂野都城 · 2007-11-05 · via 博客园 - 狂野都城

如果在查询TOP语句的后面使用Order by,而且Order by字段中有重复值的话,那么这个TOP很可能会失效,
会返回所有记录
比如:
 
select top 5 from News order by createDate
如果createDate中有重复值,那么很有可能会显示出所有的记录来,此TOP功能会失效的
但如果createDate中无重复值,那么TOP功能还是有效的

因此,在ACCESS中使用TOP功能要注意一下order by的字段是否会有重复值,如果象createDate是"年
--日 时:分:秒"的,那基本上问题不大的。
但为了保险起见,我们也可以采用"加入主键"的方式:
 
select top 5 from News order by createDate desc,id desc

用主键作"不可能重复"的保障就可以防止此问题出现了!!

希望这对某些朋友有用!!

在网上找到一个相关的解释:
JET SQL不是 T
-SQL语句。
jet sql 会返回重复值,也就是说,一个表中如果 
ORDER BY 的字段都是 0 ,一共有100条记录,即使你用select TOP 1 来返回记录,也同样返回100条记录,因为 JET DB 无从在这100条记录里面判断先后次序,只能返回100条。要解决此问题可以在后面加入一个主键字段