Place euro symbol in a table

Asked

Viewed 153 times

2

In my consultation I have two column where I do the sum of hours and the sum of the amount to be paid by the client in those hours:

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

Row summing the amount payable: SUM(CONCAT(E.Valor, '€')) AS Valor 1º e 2º Hora

In mysql you are showing the results in this way as shown in the image:

inserir a descrição da imagem aqui

By showing the query data in php I want to show the hour column in time format and the column that adds the value to pay with the euro symbol

  • Does not give, returns the values in the column as data type BLOB

  • It worked, in relation to the euro solved and in relation to the hour it can help?

  • I didn’t understand the time. For example: 2.00 would be what?

  • Instead of 2.00 should show up 2:00, because of the form it is, it gives to understand a decimal number. But that is only a detail, otherwise I keep

  • It worked, so it gets a professional presentation. Thank you

  • Dispose friend!

Show 1 more comment

1 answer

1


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

Use the function CONVERT, 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 make a REPLACE:

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

Browser other questions tagged

You are not signed in. Login or sign up in order to post.