Rounding values

The SQL query results at CosmoSim return the values with as many digits as are stored in the database – but maybe that’s too much for you.
In that case, you can use the ROUND-function. It is a standard SQL function that rounds to the given number of digits after the comma, i.e. ROUND(x,3) will round a number like 123.7529215654 to 123.753. So if you want to retrieve the rounded positions of 10 FOF clusters from the MDR1.FOF table, then use a query like this:

SELECT ROUND(x,3) as rounded_x, ROUND(y,3) as rounded_y, ROUND(z,3) as rounded_z

Please do not use CONVERT and DECIMAL, e.g. CONVERT(x, DECIMAL(10,3)) for this. Yes, this is actually correct (My)SQL syntax, but the parser used by our parallel query reformulator (PaQu) is not parsing this correctly in the current version (yes, it’s a bug). We may enable it in the future, but for now, please use ROUND() instead.

Previous post:     Next post:
Proudly powered by Daiquiri
©2016 The CosmoSim databaseImprint and Data Protection Statement