The following result is created from a SELECT statement I’ve created:
total date currency provider conversion_to_usd
170.0168890000 2012-01-01 AUD Telluride 1.06694
177.5532500000 2012-01-01 CAD Telluride 1.00030
33.1864000000 2012-01-01 NZD Telluride 0.82966
687.4900000000 2012-01-01 USD Telluride 1.00000
How would I sum up the rows sales here, for example 170.016*1.066 + 177.55*1.00…
SELECT SUM(...) FROM <SELECT STATEMENT ABOVE> ?
You can give the
SELECTstatement an alias.This will then allow you to refer to the columns
totalandconversion_to_usd, to use their values on theSUM, thus, performing the required calculations: