SELECT DISTINCT是否暗示某种结果 [英] Does SELECT DISTINCT imply a sort of the results
本文介绍了SELECT DISTINCT是否暗示某种结果的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!
问题描述
在SELECT查询中包括DISTINCT是否意味着应该对结果集进行排序?
Does including DISTINCT in a SELECT query imply that the resulting set should be sorted?
我不认为这样做,但是我正在寻找权威的答案(网络链接).
I don't think it does, but I'm looking for a an authoritative answer (web link).
我有这样的查询:
Select Distinct foo
From Bar
在oracle中,结果是不同的,但未按排序顺序.在Jet/MS-Access中,似乎需要做一些额外的工作来确保结果是分类的.我假设在这种情况下,oracle遵循规范,而MS Access超越了.
In oracle, the results are distinct but are not in sorted order. In Jet/MS-Access there seems to be some extra work being done to ensure that the results are sort. I'm assuming that oracle is following the spec in this case and MS Access is going beyond.
此外,有没有一种方法可以给表提示它应该在foo
上排序(除非另有说明)?
Also, is there a way I can give the table a hint that it should be sorting on foo
(unless otherwise specified)?
推荐答案
查看全文