sql SUM()函數 求和實例教程,好了下面來看看吧.
sum是用來求一列的數據之和的,必須是數值型的哦.下面來看看語法吧.
SELECT SUM(column_name) FROM table_name
我們舉個例子來說明一下吧.
O_Id OrderDate OrderPrice Customer 12008/11/121000Hansen22008/10/231600Nilsen32008/09/02700Hansen42008/09/03300Hansen52008/08/302000Jensen62008/10/04100Nilsen
SELECT SUM(OrderPrice) AS OrderTotal FROM Orders結果為.5700