_ | 覦覈襦 | 豕蠏手 | 殊螳 | 譯殊碁
FrontPage › 豕螳螻殊螳豌襴

Contents

1
2 ORDERED FORWARD, ORDERED BACKWARD
3 Partitioned Table


1 #

螳 れ螻 螳 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
max.jpg

SELECT MIN(UnitPrice) FROM SalesOrderDetail
min.jpg

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

partitioned_table_max.jpg
蠍 蠍郁鍵..
企: : るジ讓曙 襦螻豺 企Ν 譯殊語. 襦螻豺
EditText : Print : Mobile : FindPage : DeletePage : LikePages : Powered by MoniWiki : Last modified 2018-04-13 23:12:53

磯Μ 蠖 れ る れ 磯Μ襯 螻 磯Μ 企蟆 蟆. 谿曙^ 伎 伎給. 螳 手 伎 蟆 蠏瑚 蠏 豌伎 讀蟇一伎蠍 覓語. れ 讌覃 譴 讌. 蠏碁Μ螻 襾 螻褐 ロ 朱ゼ 螳碁.