1. Anuncie Aqui ! Entre em contato fdantas@4each.com.br

[SQL] How to use FORMAT() on SUM() in MySQL

Discussão em 'Outras Linguagens' iniciado por Stack, Novembro 6, 2024 às 10:32.

  1. Stack

    Stack Membro Participativo

    I want to use FORMAT on the result of SUM to produce a currency style format with commas and no decimal places.

    I'm trying the following using MySQL 5.7:

    SELECT FORMAT(SUM(x.07_17 / fx.07_17), 0) AS total

    Issue


    The problem is this changes the text-output drastically.

    • Without the format, I get the correct result of SUM: 350914.
    • With the format in place, I get only the first 3 numbers: 350.

    What am I doing wrong?

    Continue reading...

Compartilhe esta Página