螳 れ螻 螳 MAX() MIN() 豌襴襯 蟆 覲 .
SELECT TOP 1 UnitPrice
FROM SalesOrderDetail
ORDER BY UnitPrice Desc
覓朱
UnitPrice 碁煙り 焔讌 . Microsoft 企 朱 MAX螳 蟲 蟆 蟠ロ讌 螻, MAX()襯 蟆 蟠ロ. 襷 碁煙るゼ 燕 螳 ′語れ レ 覩語讌 螻, MAX()螳 譯 る DESC襦 燕覃 MAX() れ螻 螳 覦覯 .
CREATE INDEX idx_UnitPrice
ON SalesOrderDetail(UnitPrice DESC)
GO
SELECT TOP 1 UnitPrice
FROM SalesOrderDetail
WHERE UnitPrice > 0
GO
--
SELECT TOP 1 UnitPrice
FROM SalesOrderDetail (INDEX = idx_UnitPrice)
GO
SELECT MAX(UnitPrice)
FROM SalesOrderDetail
'SalesOrderDetail' 企. れ 1, 朱Μ 所鍵 2, 覓朱Μ 所鍵 0, 覩碁Μ 所鍵 0.
2 ORDERED FORWARD, ORDERED BACKWARD #
貎朱Μれ 覈 螳 觜朱 豌襴. TOP 1 碁煙れ 伎 MAX螳 螳語 蟆企. 蠏碁 MSSQL Server 企蟆 覈朱 讌 碁煙り る TOP MIN(), MAX()襯 . 讀, 朱 碁煙るゼ 所碓, 覃 蠏 覦 覦レ朱 碁煙るゼ 暑.
SELECT MAX(UnitPrice) FROM SalesOrderDetail
SELECT MIN(UnitPrice) FROM SalesOrderDetail
FORWARD. BACKWARD朱 蟆 覲 蟆企. 願 碁煙れ れ覦レ 企 蟆企.
3 Partitioned Table #
SQL Server 2005覯 伎覿磯 Partitioned Table MIN(), MAX() 伎 譯殊襯 . 牛磯伎 ろ螻 レ 譯朱 貉殊 覲 譯殊伎 . 襯 れ れ螻 螳 蟆曙磯.
--Partitioned Table 企蟆 覃 焔 譟磯 蟾. 企 觚.. <;;
SELECT CONVERT(char(8), MAX(RegDT - 1), 112) DT
FROM TableA
--企蟆 伎
SELECT
CONVERT(char(8), DT, 112) DT
FROM (SELECT MAX(RegDT - 1) DT FROM TableA) A