Nikos: > > #using grass6_dev, compiled some weeks ago > ... > > # sql expression > > echo "UPDATE sample_1_grid_points SET exprtest=burned_pix / 10" | > > db.execute > > > and I always get a "0". Multiplication, addition and subtraction work > > fine but division seems not. > > Not always. The problem is that the decimals are not printed so I see > only the leading 0 and the ".xxx" is missing.
quoting Hamish: < try "/ 10.0", then it may output floating point number instead of integer. (int/int gives int as a result in many programming languages) > Indeed, it's a matter of integer output. To exemplify, the following sql expression works fine: # multiply integer columns by "1." echo " UPDATE sample_1_grid_points SET burned_percent = (burned_pix * 1. / reference_pix *1. ) * 100 " | db.execute It'll be useful to have an example in v.db.update/ db.execute man pages. Kindest regards, Nikos _______________________________________________ grass-user mailing list [email protected] http://lists.osgeo.org/mailman/listinfo/grass-user
