jeudi 15 octobre 2015

calculations imprecise, Redshift, postgresql

I am wandering why I am getting imprecise results even though I did type casting.

select (sum(sellerid)::decimal/count(*)::decimal) from winsales

This is the example from the Redshift documentation. http://ift.tt/1jD7ZB0

It should be giving something like 2.454545, but it truncates the value to 2.45. Why is that and how can I increase the precision? Tried both float4 and float8 and get the same result.




Aucun commentaire:

Enregistrer un commentaire