SQL: Rounding in the SELECT

Alexander Laurent -  
 Alexander Laurent -
Hello everyone,

Here, I created a query in Interbase 6.5 by logging into SQL View, and in my SELECT I added a calculated field. The result contains at least 6 digits after the decimal point, and I would like to add a function that allows me to round my results to 2 digits after the decimal point.

Here is the concerned line: SELECT Sum (distinct ticket_detail.prix_ttc/arti_stock.pv_ttc) as poids

What should I add to achieve this?

Thanks in advance
Best regards, Alexander Laurent
Configuration: Windows XP Internet Explorer 7.0

8 answers

Alain42
 
Hello,

try with:

ROUND(X,D)

Returns the argument X, rounded to a number with D decimal places. With two arguments, the value is rounded with D decimal places.

with a query like:

SELECT cast, ROUND(Sum (distinct ticket_detail.prix_ttc/arti_stock.pv_ttc),D) ...................


to be checked, I'm not at all sure about the syntax

but X should be your value to round.
3