Decimals in SQL

0

I need to know how to make prices go like this:

1,250.00€

Now in the BD I have it put like this, decimal(10,2) and it looks like this: 1250.00€

    
asked by Miguel 27.08.2018 в 11:34
source

1 answer

0

It is a question of format when representing the values and for this you have the function FORMAT from MySQL

Structure to follow:

SELECT FORMAT(columna, 2) FROM tabla.

Sentence that solved the problem to the user (we do not know the sql table):

 $results = $mysqli->query("SELECT Total, FORMAT(SUM(Total), 2) as suma, Fecha,Total FROM pedidos WHERE Estado=1 and Iduser =" . $_GET['ID']);
    
answered by 27.08.2018 / 11:40
source