簡體   English   中英

MySQL 得到不同幣種的SUM

[英]MySQL get the SUM of different currencies

在 MySQL 數據庫中要獲取列的總和,我只需執行以下操作:

SELECT SUM(orderamount_total) FROM io__order_infos_hext

是否可以僅在一個 SQL 請求中獲取列currency中定義的不同貨幣的orderamount_total的總和?

在此處輸入圖像描述

你只需要一個 group by

SELECT currency, SUM(orderamount_total) 
FROM io__order_infos_hext
group by currency

是的,這是可能的。 請使用 GROUP BY select 子句。

SELECT SUM(orderamount_total) FROM io__order_infos_hext GROUP BY your_currency_column;

暫無
暫無

聲明:本站的技術帖子網頁,遵循CC BY-SA 4.0協議,如果您需要轉載,請注明本站網址或者原文地址。任何問題請咨詢:yoyou2525@163.com.

 
粵ICP備18138465號  © 2020-2024 STACKOOM.COM