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

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:

主站蜘蛛池模板: 伊川县| 辉南县| 思茅市| 玛纳斯县| 临武县| 邯郸市| 长岭县| 梅河口市| 太白县| 仪征市| 敦化市| 阳原县| 曲周县| 修文县| 巴中市| 芦溪县| 西乌珠穆沁旗| 申扎县| 韶关市| 阜康市| 江永县| 永胜县| 长海县| 渭源县| 洪雅县| 张家川| 乌恰县| 荆门市| 隆回县| 邻水| 丹棱县| 岫岩| 奉新县| 仁怀市| 类乌齐县| 台中县| 广宗县| 黔江区| 台湾省| 扶沟县| 赫章县|