【译文】对结果记录集进行排序(三)-周芳
Access软件网QQ交流学习群(群号码198465573),欢迎您的加入!
首页 >技术文章> Access数据库-查询/SQL语句


【译文】对结果记录集进行排序(三)

发表时间:2014/3/17 9:14:21 评论(0) 浏览(5697)  评论 | 加入收藏 | 复制
   
摘 要:对结果记录集进行排序
正 文:

 来自:微软    翻译:周芳

【原文】对结果记录集进行排序(三)

      要指定一个特定的一个或多个字段排序顺序的结果集,可以使用可选的order BY子句。记录可以按照升序(ASC)或降序(DESC)排序,默认为升序。

orDER BY子句中引用字段不需要Select语句的字段列表,和排序可以应用到字符串、数字、日期/时间值。总是BYclause订货在Select语句的结束。


VBA
Select *
    FROM tblCustomers
    orDER BY [Last Name], [First Name] DESC


      在ORDER BY子句中,您还可以使用数字(或位置)代替字段名称。


VBA
Select *
    FROM tblCustomers
    orDER BY 2, 3 DESC


【译文】Sorting the Result Set

      To specify a particular sort order on one or more fields in the result set, use the optional orDER BY clause. Records can be sorted in either ascending (ASC) or descending (DESC) order; ascending is the default.


     Fields referenced in the orDER BY clause do not have to be part of the Select statement's field list, and sorting can be applied to string, numeric, and date/time values. Always place the orDER BYclause at the end of the Select statement.


VBA
Select *
    FROM tblCustomers
    orDER BY [Last Name], [First Name] DESC


      You can also use the field numbers (or positions) instead of field names in the orDER BY clause.

VBA
Select *
    FROM tblCustomers
    orDER BY 2, 3 DESC


Access软件网交流QQ群(群号:198465573)
 
 相关文章
【译文】如何用ADO代码实现窗体记录集的绑定  【周芳  2013/12/24】
【译文】如何检索已安装打印机的列表  【周芳  2013/12/31】
【译文】如何输出报表到XML文件  【周芳  2014/1/27】
【译文】如何使用Access SQL 检索记录(一)  【周芳  2014/2/17】
【译文】查询限制结果记录集(二)  【周芳  2014/3/10】
常见问答
技术分类
相关资源
文章搜索
关于作者

周芳

文章分类

文章存档

友情链接