You can use the FORMAT
function as follows:
SELECT t.*,
CONCAT('de ', FORMAT(t.valor, 2, 'de_DE'), ' por ', FORMAT(t.desconto, 2, 'de_DE')) AS promocao
FROM (SELECT c.Valor as valor,
c.valor - c.valor * 20/100 AS desconto
FROM comissao c
ORDER BY c.valor DESC) t;
The result of the promotion column would be:
of 14,230.00 for 11,384.00
About function:
FORMAT(X,D[,locale])
Formats the number X to a format like '#, ###, ###. ##', rounded to D decimal places, and returns the result as a string. If D is 0, the result is no decimal point or fractional part.
The optional third parameter enables the locale to be specified as the decimal point, thousands separator, and grouping between separators. .... If no locale is specified, the default is 'en_US'.
Or in free translation:
Format an X number for a format '#, ###, ###. ##' rounding to the decimal places D, and returns the result as a string. If D is 0, the result has no decimals.
The third (optional) parameter enables the locale specification used to determine the decimal separator, the thousands separator, and the grouping between result separators. .... If no location is specified, the default is 'en_US'.
I used the de_DE
location because Germany uses the international standard that is the same as the one we used and the pt_BR
did not have the thousands separator.