2015-06-12 68 views
0

我有以下查詢:截斷在選擇

SELECT  
SUM(`SPEND_AMOUNT`) AS 'Total Spend Amount', 
SUM(`SPEND_AMOUNT`)/COUNT(DISTINCT `INVOICENUMBER`) AS 'Average Spend Amount' 
FROM 
`TABLE` 

我想截斷結果的「平均消費金額」爲幫助兩位小數places.Thanks(?)。

+0

檢查此http://www.w3resource.com/mysql/mathematical-functions/mysql-truncate-function.php –

回答

0

回合(SUM(SPEND_AMOUNT)/ COUNT(DISTINCT INVOICENUMBER),2)