Forgot to mention, it would be a lot simpler and much faster to calculate by adding an extra column in the db with the modified values and keep a real length column for distance calculations and it wont increase the db size too much. cheers