How to limit the result of a query to 2 decimal places?

Asked

Viewed 393 times

-1

I have the following appointment:

SELECT  SUM(ValorBruto)
FROM faturas
WHERE DataCaptura between'2018-10-01' and '2018-10-30'

The result is displayed to 4 decimal places. It would cost to view only 2. How do I?

  • Did not work :( Incorrect syntax near 'SUM'

  • Use the to_char function to format the view the way you want it.

1 answer

0

Try something like that

SELECT round(CAST(float8 SUM(ValorBruto) as valorBruto),2)
FROM faturas
WHERE DataCaptura between'2018-10-01' and '2018-10-30'

Browser other questions tagged

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