官术网_书友最值得收藏!

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:

主站蜘蛛池模板: 麻栗坡县| 芦山县| 上犹县| 伊春市| 合肥市| 五大连池市| 德令哈市| 鲜城| 延长县| 哈巴河县| 民乐县| 德格县| 乐安县| 神池县| 青海省| 色达县| 尚志市| 伽师县| 岳阳县| 呼和浩特市| 屯门区| 钟山县| 福州市| 西城区| 孟州市| 四平市| 郴州市| 博客| 武城县| 谢通门县| 无为县| 库车县| 鸡东县| 宜兰县| 年辖:市辖区| 平陆县| 长岛县| 莫力| 北川| 松溪县| 池州市|