Put the euro symbol on a table

2

In my query I have two columns where I make the sum of hours and the sum of the amount to be paid by the client at these times:

Line summing times: CAST(SUM(SEC_TO_TIME(E.teste1))/100 AS DECIMAL (15,2)) AS QTD 1º e 2º Hora

Line that adds the amount to pay: SUM(CONCAT(E.Valor, '€')) AS Valor 1º e 2º Hora

In mysql you are displaying the results as shown in the image:

When displaying query data in php I want to display the hour column in time format and the column that adds the value to pay with the euro symbol

    
asked by anonymous 07.03.2018 / 11:47

1 answer

2

For CONCAT , you are adding concatenation, when you should concatenate the sum, and convert the result to CHAR .

Use the CONVERT function by changing the code to:

CONVERT(CONCAT(SUM(E.Valor), '€'), CHAR(8)) AS 'Valor 1º e 2º Hora'
/* o 8 é o tamanho do resultado. altere conforme sua conveniência*/

Regarding the time format of the first query, you can REPLACE :

REPLACE(CAST(SUM(SEC_TO_TIME(E.Valor))/100 AS DECIMAL (15,2)), '.', ':')
AS QTD 1º e 2º Hora
    
07.03.2018 / 12:40