The logic seems correct. Are you getting any output from it at all? Maybe try: SELECT SQRT(POW((50-x),2)+POW((60-y),2))