Skip to content
Advertisement

MySQL get the SUM of different currencies

In a MySQL database To get the SUM of a column I just do:

SELECT SUM(orderamount_total) FROM io__order_infos_hext

Is it possible in only one SQL request to get the SUM of orderamount_total of the different curriences defined in the column currency?

enter image description here

Advertisement

Answer

You just need a group by

SELECT currency, SUM(orderamount_total) 
FROM io__order_infos_hext
group by currency
User contributions licensed under: CC BY-SA
2 People found this is helpful
Advertisement