Sign in with Microsoft
Sign in or create an account.
Hello,
Select a different account.
You have multiple accounts
Choose the account you want to sign in with.

傳回查詢中指定欄位中包含之一組值的最小值或最大值。

語法

min ( expr )

max ( expr )

expr 佔位元代表 字串運算式 識別包含您要評估之數據的欄位,或使用該欄位中的數據執行計算的運算式。 expr 中的操作數可以包含數據表字段的名稱、常數或函數 (可以是固有的或使用者定義的,但不能包含其中一個其他 SQL 匯總函數) 。

註解

您可以使用 MinMax ,根據指定的匯總或分組來判斷欄位中最小和最大的值。 例如,您可以使用這些函數傳回最低且最高運費。 如果沒有指定匯總,則會使用整個數據表。

您可以在查詢表達式以及QueryDef 物件的 SQL 屬性或以 SQL 查詢建立 Recordset 物件時,使用 MinMax

查詢範例

Expression

結果​​

SELECT Min (Unitprice) 為 ProductSales 的表達式1;

傳回 “Unitprice” 字段的最低單價,並顯示在運算式1 欄中。

SELECT Max (Unitprice) 為 Expr1 from ProductSales;

傳回 “Unitprice” 字段的最大單價,並顯示在 xpr1 欄中。

SELECT Max (Unitprice) 為 ProductSales 的 MaxPrice;

傳回 「Unitprice」 字段的最大單價,並顯示在 「MaxPrice」 欄中。

計算 SQL 函數中的欄位

Need more help?

Want more options?

探索訂閱權益、瀏覽訓練課程、瞭解如何保護您的裝置等等。

社群可協助您詢問並回答問題、提供意見反應,以及聆聽來自具有豐富知識的專家意見。

Was this information helpful?

How satisfied are you with the translation quality?
What affected your experience?
By pressing submit, your feedback will be used to improve Microsoft products and services. Your IT admin will be able to collect this data. Privacy Statement.

Thank you for your feedback!

×