At the moment I am working on VAT for each country where the Sale arrival country.
this VAT is working well and correct, however, I having an issue with 0.0000000 as I tried put coalesce with 0.00 but it keeps displayed with '3632.608266' rather than '3632.60' which I am looking for
Here are MySQL queries I wrote
SUM(COALESCE((TOTAL_ACTIVITY_VALUE_AMT_VAT_INCL)-(TOTAL_ACTIVITY_VALUE_AMT_VAT_INCL)/(VAT_Standard_Rate + 1),0.00)) AS 'decmical',
Here is a full version
SELECT
SALE_ARRIVAL_COUNTRY,
tbl_countries.Country,
VAT_Standard_Rate,
SUM(COALESCE((TOTAL_ACTIVITY_VALUE_AMT_VAT_INCL)-(TOTAL_ACTIVITY_VALUE_AMT_VAT_INCL)/(VAT_Standard_Rate + 1),0.00)) AS 'decmical',
SUM(COALESCE(TOTAL_ACTIVITY_VALUE_AMT_VAT_INCL)+(TOTAL_ACTIVITY_VALUE_AMT_VAT_INCL)/(VAT_Standard_Rate + 1)-(TOTAL_ACTIVITY_VALUE_AMT_VAT_INCL)) AS 'NET',
SUM(COALESCE(TOTAL_ACTIVITY_VALUE_AMT_VAT_INCL)-(TOTAL_ACTIVITY_VALUE_AMT_VAT_INCL)/(VAT_Standard_Rate + 1)) AS 'VAT',
SUM(TOTAL_ACTIVITY_VALUE_AMT_VAT_INCL) AS 'Total',
TRANSACTION_CURRENCY_CODE as 'Currency'
FROM
tbl_vat
INNER JOIN tbl_countries
INNER JOIN tbl_vat_rate
ON amazon.tbl_vat.SALE_ARRIVAL_COUNTRY=tbl_countries.alpha_2 AND tbl_countries.Country=tbl_vat_rate.Country_of_Purchase
GROUP BY tbl_countries.Country