- Learn T-SQL Querying
- Pedro Lopes Pam Lahoud
- 113字
- 2021-06-24 14:38:10
ORDER BY
The ORDER BY clause orders the results. The default order is ascending, meaning that the ASC keyword can be omitted. To produce the result set in descending order, DESC must be set explicitly. Building on the same example from the WHERE section, the following code block is used to explicitly present results in descending order of product name and location name:
SELECT P.Name AS ProductName, [PI].Quantity, L.Name AS LocationName
FROM Production.Product AS P
INNER JOIN Production.ProductInventory AS [PI] ON P.ProductID = [PI].ProductID
INNER JOIN Production.Location AS L ON [PI].LocationID = L.LocationID
WHERE P.Name LIKE 'Touring%'
ORDER BY P.Name DESC, L.Name DESC;
The following screenshot shows the results in the specified order:

推薦閱讀
- Java編程全能詞典
- WOW!Illustrator CS6完全自學(xué)寶典
- CSS全程指南
- 大數(shù)據(jù)改變世界
- WordPress Theme Development Beginner's Guide(Third Edition)
- Moodle Course Design Best Practices
- 塊數(shù)據(jù)5.0:數(shù)據(jù)社會(huì)學(xué)的理論與方法
- 運(yùn)動(dòng)控制器與交流伺服系統(tǒng)的調(diào)試和應(yīng)用
- 網(wǎng)絡(luò)管理工具實(shí)用詳解
- 在實(shí)戰(zhàn)中成長(zhǎng):Windows Forms開發(fā)之路
- Spatial Analytics with ArcGIS
- INSTANT Puppet 3 Starter
- Linux系統(tǒng)下C程序開發(fā)詳解
- 智能制造系統(tǒng)及關(guān)鍵使能技術(shù)
- PowerPoint 2010幻燈片制作高手速成