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

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:

主站蜘蛛池模板: 内丘县| 苏尼特左旗| 明光市| 华容县| 荥阳市| 清涧县| 广州市| 聊城市| 溧阳市| 苗栗市| 璧山县| 临汾市| 新竹市| 洛扎县| 屏南县| 康乐县| 吉安市| 澄城县| 上虞市| 如皋市| 庄浪县| 新余市| 宾阳县| 皮山县| 运城市| 分宜县| 重庆市| 太湖县| 元阳县| 海原县| 通化县| 三明市| 巴东县| 吴堡县| 洞头县| 新余市| 金湖县| 嵊州市| 集贤县| 牙克石市| 克东县|